FOR

Function:

The FOR command controls the repetitive execution of a statement block in the same way as a DO command. It differs in that the looping condition is not restricted to integers and is much more flexible. FOR commands may be nested.

Syntax:

FOR(init. ; condition ; reinit.)
	statement-block

init. specifies the initial value of the loop counter or any other variable used in the statement block. If no initialization is required this code may be void.

condition specifies the looping condition. The statement block is executed if the condition (which must have a relational operator construct) is true. If the condition is false, looping is stopped and the statement following the statement block is executed. This code may be void.

reinit. specifies the code executed after each pass through the statement block and before the condition is tested. This code may be void.

Examples:

FOR(I=1;I<=100;I=I+1) A(I)=0.# same as DO loop

FOR(;A(N)>0.;N=N+STEP(J))
$(
CALL FUNCT(N,J,A,STEP)
B(N)=B(N)+A(N)
$)