using UnityEngine;
using System.Collections;
public class Love : MonoBehaviour {
 // Use this for initialization
 void Start () {
        //沿著愛心逆時針順序跑
        //              A      C
        for (int i=1; i<=4 ; i++ )
            {
            //B
            Debug.Log ("for情書傳給第"+i+"位同學");
            //B
            }
   
        //=============================
  
        int w = 1;
        while (w<=4)
            {
            Debug.Log ( "while情書傳給第" + w + "位同學" );
            w++;
            }
   
        //=============================
  
        int d = 1;
        do
            {
            Debug.Log ( "do while情書傳給第" + d + "位同學" );
            d++;
            }
        while (d<=4);
        }
 
 // Update is called once per frame
 void Update () { 
 }
}
❤❤Fungus新課程即將發布,快寫問卷拿優惠❤❤
          
        
        
本教學系列絕非正統教學,但自我期許是趣味教學,裡面的中文變數只是為了教學使用,正式寫專案時還是建議使用英文變數,倘若各路高手發現內容有誤,煩請不吝指教以矯正視聽,感謝
        
      
2016年10月18日 星期二
Unity C# 程式心得分享 for迴圈 while迴圈 loop
訂閱:
張貼留言 (Atom)
 
 
非常喜欢你的教程!
回覆刪除