Author Topic: For Statement  (Read 536 times)

Can someone give me a "for statement", I can do the rest from there, I've searched but I can't find one :| and don't know the exact code for it.

Code: (Format) [Select]
for ( %start; %while; %mod )
{
     // Functions
}

%start is the declaration of the intitial value for the variable
%while is the condition for the loop to continue
%mod is how the variable is modified after each loop

Code: (Example) [Select]
for ( %i = 1; %i <= 10; %i++ )
{
     echo( %i );
}

That would have %i start as one.
While it's less than or equal to ten, perform the function(s):
 - Display the value of  %i in the console
Increment %i by one after each loop

Quote from: Output
1
2
3
4
5
6
7
8
9
10

Nice Resource :), thank you.

I have a resource that has some useful info on For and while statements