For loop
by Jamal Moon · in Technical Issues · 02/03/2008 (9:56 pm) · 2 replies
Can someone please explain what the for loop does or when you use it? I usually see something like this...
Also, what would you do with %i after you made the for loop?
thanks
for(%i=0; %i < 7; %i++)
{
.....Also, what would you do with %i after you made the for loop?
thanks
About the author
Torque Owner Cinder Games
%i=0 - it initialized the variable %i to zero.
%i < 7 - Is our variable less then 7? This determine is the loop is done again or not.
%i++ - amount to add to our variable each loop.
in this example whatever code is in the for loop, will be repeated 7 times.
there's no need to do anything with %i as it is a local variable and is deleted after the function is run.