example:
•
•
•
NEXT
is
used
to
terminate, or create a loop epilogue
in,
REPeat and FOR loops.
syntax:
NEXT identifier
The
Identifier must match that
of
the loop which the NEXT
is
to
control
10
REMark
this
loop
must
repeat
forever
11
REPeat
infinite
loop
12
PRINT
"stiLL
looping"
13
NEXT
infinite_loop
ii.
10 REMark
this
loop
wi
lL
repeat
20
times
11
LET
Limit
=
20
12
FOR
index=1
TO
limit
13 PRINT
index
14
NEXT
index
lii.10REMarkthisLoopwilltetLyouwhena30isfound
11
REPeat
loop
12
LET
number =
RND(1
TO
10m
13
IF
number
<>
30
THEN
NEXT
Loop
14
PRINT
number;
"is
30"
15 EXIT
LOOP
16
END
REPeat Loop
If
NEXT
is
used inside a
REPeat·
END REPeal construct
it
will
force
proceSSing
to
continue
at
the statement following the matching REPeat statement.
The NEXT statement can
be
used
to
repeat the FOR loop
with
the control variable
set
at
its
next
value.
If
the FOR loop
is
exhausted then processing
will
continue
at
the
statement following the NEXT; otherwise processing
will
continue
at
the statement after
the FOR
To
provide compatibility with other
BASICs,
SuperBASIC supports the
ON
GOTO and
ON GOSUB
statements.
These
statements allow a variable
to
select
from
a
list
of
possible
line numbers a line
to
process
in
a
GOTO
or GOSUB statement.
If
too
few
line numbers
are
specified
in
the
list
then
an
error
is
generated.
syntax:
ON variable
GOTO
expression *
[,
expression] *
ON variable GOSUB expression *
[.
expression] *
example:
I.
ON
x
GOTO
10,
20,
30,
40
ii.
ON
select_variable
GOSUB
1000,
2000,3000,4000
SElect
can be used
to
replace these two
BASIC
commands.
12/84
NEXT
repetition
in
REPeat
in
FOR
ON
GOTO
ON
GOSUB
comment
39