Main sections
NEXT
FOR counter# = start# TO end# |STEP steps#|
...
NEXT
The NEXT statement completes a FOR block of code. It indicates to the program that it should go jump back to the line of code following the FOR statement as long as the conditions of the FOR loop are still true (i.e. loop over the code block whilever counter# is in the range of start# to end#).
It also causes counter# to be increased (or decreased) by the value in steps#. If steps# is not set, steps# defaults to +1. The code will loop until counter# is not in the range of [start#; end#] anymore.
Sample:
FOR i=0 TO 10 STEP 2
PRINT i, 100, 32*i
NEXT
SHOWSCREEN
MOUSEWAIT
Output:
0
2
4
6
8
10