Vector Basic Interpreter Basic 80 Reference Manual - page 55
SK, Extended, Disk
To
allow
a
series
of
instructions
to
be
performed in a loop a given number of times.
as
a
counter.
The
first
numeric
expression
(x) is the initial value of
the counter.
The second numeric expression
(y)
is
the final value of the counter.
The program
lines following the FOR statement
are
executed
until
the
NEXT statement is encountered.
Then
the
counter
is
incremented
by
the
amount
specified
by STEP.
A check is performed to see
if thevalue of the counter is now greater
than
the
final
value
(y).
If
it is not greater,
BASIC-SO
branches back to
the
statement
after
the
FOR
statement and the process is repeated.
If it is greater, execution continues
with
the
statement following the NEXT statement.
This is
a FOR •••NEXT loop.
If STEP
is
not
specified,
the
increment is assumed to be one.
If STEP is
negative, the final value of the counter is
set
to
be less than the initial value.
The counter
is decremented each time through the
loop,
and
the
loop
is executed until the counter is less
than the final value.
initial
the step
of
the
The body of the loop is skipped if
the
value
of
the
loop
times the sign of
exceeds the final value times the
sign
step.
Nested Loops
FOR •••NEXT loops
may
be
nested,
that
is,
a
FOR •••NEXT loop may be placed within the context
of another
FOR •••NEXT
loop.
When
loops
are
nested,
each
loop
must have a unique variable
name as its counter.
The -NEXT statement for the
inside
loop
must
appear
before
that for the
outside loop.
If nested loops have the same end
point,
a
single NEXT statement may be used for
all
of them.