Specifications

213
The default value of
increment is 1.
You can nest FOR...NEXT statements to a maximum of 10 levels.
When using the
FOR...NEXT statement together with block-structured statements
(
DEF FN...END DEF, FOR...NEXT, FUNCTION...END FUNCTION, IF...THEN
...ELSE...END
IF, SELECT...CASE...END SELECT, SUB...END SUB and
WHILE...WEND), you can nest them to a maximum of 30 levels.
A same
controlvariable should not be reused in a nested loop. Reusing it
will cause a run-time error when the
NEXT statement for an outer FOR...NEXT
loop executes.
Nested loops should not be crossed. Shown below is a correctly nested sample.
FOR i%=1 TO 10
FOR j%=2 TO 100
FOR k%=3 TO 1000
NEXT k%
NEXT j%
NEXT i%
FOR l%=1 TO 3
.
.
.
NEXT l%
Syntax errors:
Run-time errors:
Error code and message Meaning
error 26:
Too deep nesting.
error 52: Incorrect use
of FORNEXT
NEXT without FOR.
error 53: Incomplete
control struc-
ture
Incomplete pairs of FOR and NEXT.
error 54: Incorrect FOR
index variable
controlvariable for FOR is dif-
ferent from that for
NEXT.
error 88: 'TO' missing TO finalvalue is missing.
Error code Meaning
01h NEXT without FOR
07h
Insufficient memory space
(Too deep nesting.)