for
Begins a loop construct.
Syntax
for(counter = init_value; expr; operation)
Input
- counter
- A variable that changes value each time a loop is completed.
- init_value
- The starting value of the loop counter.
- expr
- A mathematical expression. If expr evaluates to zero, the expression is false, the loop is terminated and the instruction following the endloop statement is executed. If expr evaluates to any other value, the expression is true and the instructions between the for and endloop are carried out.
- Operation
- The operation performed on the loop counter each time a loop is completed.
Example
{for(a=0; a<=PI/2;
    a+=PI/12)}
   Angle: {a, %6.4¦}
   Sin: {sin(a), %6.4¦}
{endloop}Angle: 0.0000  Sin: 0.0000
Angle: 0.2617  Sin: 0.2588
Angle: 0.5235  Sin: 0.5000
Angle: 0.7853  Sin: 0.7071
Angle: 1.0471  Sin: 0.8660
Angle: 1.3089  Sin: 0.9659
Angle: 1.5707  Sin: 1.0000Comments
A for-loop consists of three parts: a for statement, an instruction or series of instructions, and an endloop statement. An initial value is specified for the counter in the for statement, as well as an exit condition and an operation to be performed on the counter each time a loop is completed.
Every for-loop must be terminated with an endloop statement.