For
Syntax:
For <Variable name> = <Expression 1> To <Expression 2> Do
// Operators
[Break;]
// Operators
[Continue;]
// Operators
EndDo;
Parameters:
<Variable name>
The ID of the variable whose value is automatically incremented by 1 on each iteration (the loop counter). The variable value can also be changed inside the loop.
<Expression 1>
A numeric expression that sets the initial loop counter value at the first iteration.
To
The range identifier between <Expression 1> and <Expression 2>.
<Expression 2>
The maximum value of the loop counter. When <Variable name> becomes greater than <Expression 2>, execution of the For operator is stopped. This value is calculated once before the loop execution and it cannot be changed inside the loop.
Do
The operators following the Do keyword are executed while <Variable name> value is less or equal to <Expression 2>.
// Operators
An operator or a sequence of operators to be executed.
Break
Breaks the loop execution at any point. Then the control is passed to the operator following the EndDo keyword.
Continue
Passes the control to the beginning of the loop where the loop conditions are calculated and evaluated. The operators following the Continue operator are skipped in this iteration.
EndDo
A keyword that denotes the end of the loop operator structure.
Description:
The loop operator For is intended for repeated execution of the operators enclosed between Do and EndDo keywords. Before the loop is executed, the value of <Expression 1> is assigned to <Variable name> variable. The value of <Variable name> is automatically incremented in each iteration of the loop. The loop counter increment is 1. The loop is executed while <Variable name> value is less or equal to <Expression 2>. The loop condition is always checked at the beginning, before the loop is executed.