The FOR statement loops (zero, one, or many times)
The FOR looping statement iterates zero or more times:
FOR var from N1 up/down to N2
Statement 1
Statement 2
ENDFOR
- Execute the statements between FOR and ENDFOR with the var (variable) first set to the value N1. Redo the same statements with var taking on the next value (up or down) toward N2. Continue until var is equal to N2.
- If N1 is already past N2 when the FOR statement is first encountered, the set of statements is not executed even once. Execution continues after the ENDFOR.