|
example for (var i = 0; i < Input.touchCount; ++i) { if (Input.GetTouch(i).phase == TouchPhase.Began) { Application.LoadLevel ("1"); what does for mean is it diffrent from if and where is it used
(comments are locked)
|
|
a for loop is a type of loop. that standard for loop sets variable i to 0, and its says as long as i is less than the user touch count, then add one to i. so its going to add 1 until i is equal to Input.touchCount.
(comments are locked)
|
|
(comments are locked)
|
|
'For' is a type of loop. It allows you do one operation for some number of times. An example for loop looks like this : First this sets i=0. Then it checks to see if i is less than 10 (i<10). If it is, it goes into the loop and prints out i. Then it increments i, by adding 1 to it ( i++) and checks to see if its less than 10 again. This keeps repeating until i is no longer less than 10.
(comments are locked)
|
