Vector Basic Interpreter Basic 80 Reference Manual - page 56
om tted,
in
which case the NEXT statement will
match the most recent FOR statement.
If a
NEX'I'
statement
is
encountered
before
its
corresponding FOR
statement,
a
-NEX'I'without
FOR-
error
message
is issued and execution is
terminated.
Example 1:
10 K-10
20 FOR I-1 TO
It
STEP 2
30 PRINT I;
40 K-K+10
50 PRINT
It
60 NEX'I'
RON
1
20
3
30
5
40
7
5-0
9
60
Ok
Example 2:
10 J-O
20 FOR I=1 TO
J
30 PRINT I
40 NEX'I'
I
In this
example,
the
because
the
initial
the final value.
loop
does
not
execute
value of the loop exceeds
Example 3:
10
r-s
20 FOR I-1 TO I+S
30 PRINT I;
40 NEXT
RON
1
2
3
4
5
6
7
S
9
10
Ok
In this example, the loop
executes
ten
times.
The
final value for the loop variable is always
set before the initial
value
is
set.
(Note:
Previous
versions
of
BASIC-SO set the initial
value of the loop variable
before
setting
the
final
value;
i.e. ,
the above loop would have
executed six times.>