DEFINES THE STEP OF A LOOP "FOR"
ACTION
The command "FOR V=S TO E STEP T" is the beginning of a group of statements, which ends with NEXT and which uses the variable V as a counter.
The first time, the counter V is initiated with starting value S (V is S).
When NEXT is executed, the counter V is increased by T, and then the group of statements between FOR and NEXT is executed again only if V is less than or equal to value in E.
Otherwise, if V is greater than E, the execution jumps to the statement after NEXT.
Remark: to start by a starting value greater than the end value, we use the value -1 as step.
Example: FOR V=10 TO 1 STEP -1
SYNTAX:
FOR V=S TO E STEP T
USE ERROR EXAMPLE
rem print the first odd integer numbers
dim i
for i=1 to 10 step 2
print i
next i
STEP
(FOR V=S TO E) STEP T
SEE ALSO
FOR
TO
NEXT