120
CHAPTER
6
Command
Reference
Explanation:
1) Repeats process contained between
FOR
and NEXT statements a number
of
times specified
by
the control variable. The value
of
this variable
is
changed,
from the initial
to
the final one,
by
the increment for each repetition
of
the
process. When
the
value
of
the control variable exceeds the final value, repeti-
tion
is
terminated.
2)
When the initial value
is
larger than the final value, the execution between
FOR~
NEXT
is
performed only once.
3) When the increment
is
positive, the value
of
the control variable increases
by
each increment. When
the
increment
is
0,
execution will be repeated end-
lessly. When the increment
is
negative, the value
of
the control variable
decreases
by
each increment.
If
increment
is
omitted, one will be specified.
4)
A NEXT statement must always correspond to a
FOR
statement and must be
written after it.
5)
FOR~
NEXT loops can have
the
following nested structure.
10
FOR
I= 1
TO
1 0
TI
20
FOR
J=11
TO
20]
30
PR
INT
I ; ": '' ; J
40
NEXT
J
50
NEXT
I
60
END
6)
Nesting can be performed with up
to
4 levels.
7) When a
FOR
~
NEXT loop
is
terminated, the value
of
the control variable
exceeds
the
final value
by
the value
of
the increment.
8) A branching
out
of
a
FOR
~
NEXT loop can be performed.
If
branching
inside a
FOR
~
NEXT loop
by
an IF statement
or
GOTO statement
is
attempted, an error occurs.