for loop Fun

var leng:int = 10;
for (var i:int = 0, j:int = leng;  i < leng; i++, j = leng - i){
	trace(i, j);
}

/*outputs
0 10
1 9
2 8
3 7
4 6
5 5
6 4
7 3
8 2
9 1
*/

Looping backwards and forwards.

Leave a Reply

Your email address will not be published. Required fields are marked *