•
•
•
Repetition
In
SuperBASIC
IS
controlled
by
two
basic program constructs. Each construct
must be identified
to
SuperBASIC:
REPEAT
Identifier FOR identifier = range
statements statements
END REPEAT identifier END FOR identifier
These two constructs are used
In
conjunction with two other SuperBASIC statements:
NEXT
Identifier EXIT identifier
Processing a NEXT statement
will
either pass control
to
the statement following the
appropnate FOR or REPeat statement, or
If
a FOR range has been exhausted,
to
the
statement following the NEXT.
Processing an EXIT
will
pass control
to
the statement
after
the END FOR
or
END REPeat
selected by the EXIT statement, EXIT can be used
to
eXit
through many
levels
of nested
repeat structures. EXIT should always be used
In
REPeat loops
to
terminate the loop
on
some condition.
A combination of NEXT, EXIT and END statements allows FOR and REPeal loops
to
have a loop epilogue added. A loop epilogue
is
a series at SuperBASIC statements
which are executed on some special condition arising within the loop:
FOR
identifier
~
for
~/ist
statements..
:Jexlt
NEXT Ident.ifier
__
next
epilogue
END FOR Identifier
The loop epilogue
is
only processed
if
the FOR loop terminates normally.
If
the loop
terminates via an EXIT statement then processing
will
continue at the END FOR and
the epilogue
will
not be processed.
It
is
possible
to
have a similar construction
In
a REPeat loop:
REPeat
identifier .. ]
statements
IF condition THEN NEXT identifier
epilogue
END REPeat identifier
This
time entry into the loop epilogue
is
controlled
by
the IF statement. The epilogue
will or will not be processed depending
on
the condition
in
the IF statement. A
SElect
statement can also be used
to
control entry
Into
the epilogue.
12/84
repetition
43