Also, you can use the STEP attribute to specify how much X will be increased each time through
the loop.
FOR x = 1 TO 5 STEP 2
PRINT x
NEXT x
Output:
(^13)
5
STOPPING LOOPS
To stop a loop prematurely, use the EXIT command, followed by either FOR or DO.
FOR x = 1 TO 5
PRINT x
IF (x = 3) THEN EXIT FOR
NEXT x
Output:
(^12)
3
( NOTE: This command only works with the DO...LOOP and FOR...NEXT commands, not with
WHILE...WEND or IF...GOTO.)