
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 FOR…NEXT
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.)
Содержание BHT-BASIC 100 SERIES
Страница 1: ......
Страница 161: ...153 Chapter 10 Sleep Function CONTENTS 10 1 Sleep Function 154...
Страница 163: ...155 Chapter 11 Resume Function CONTENTS 11 1 Resume Function 156...
Страница 173: ...165 Chapter 13 Backlight Function CONTENTS 13 1 Backlight Function 166...
Страница 192: ...Chapter 14 Statement Reference 184 Example OPEN master Dat AS 1 FIELD 1 20 AS bar 10 AS ky CLFILE 1 CLOSE 1...
Страница 249: ...241 Example CLOSE IF kyIn Y THEN KILL Master Dat END IF Reference Statements CLFILE...
Страница 349: ...341 Run time errors Error code Meaning 05h Parameter out of the range checktype is out of the range...
Страница 383: ...375 Run time errors Reference Error code Meaning 05h Parameter out of the range Functions LEFT LEN and RIGHT...