for loop

Syntax

for <number variable> := <number expression1> to <number expression2> {step value}

begin

<statements>;

end;

Note:

If counting up (for i:=1 to 10) then the 'step ...' clause is not required - 1 is assumed. However, if counting down, or counting in values other than 1, you should use the step clause.

For Example

lnIndex : number;

 

for lnIndex := 1 to 100

begin

print(lnIndex);

end;

 

for lnIndex := 100 to 1 step -1

begin

print(lnIndex);

end;