The for loop allows you to iterate over a variable for a specific range of values. You must supply three expressions to a for statement: a variable that is set to an initial value, a conditional statement that determines when the looping ends, and an expression that changes the value of the variable with each loop. For example, the following code loops five times. The value of the variable i starts at 0 and ends at 4, and the output will be the numbers 0 through 4, each on its own line.
var i:int;
for (i = 0; i < 5; i++) {
trace (i);
}
0 komentar:
Post a Comment