GOTO
For compatibility with other
BASICs,
SuperBASIC supports the
Gam
statement.
Gam
will unconditionally transfer processing
to
the statement number specified. The statement
number specification can be an expression.
•
Gam
line~number
syntax:
example:
I.
GOTO
program
start
ii.
GOTO
9999
-
comment
The control structures available
In
SuperBASIC make the GOTO statement redundant.
•
IF
THEN
ELSE
END
IF
The IF statement allows conditions
to
be tested and the outcome of that
test
to
control
subsequent program
flow.
The IF statement can be used
in
both a long and a short form:
short
The THEN keyword
is
followed on the same logical line by a sequence of SuperBASIC
keyword.
This
sequence of SuperBASIC statements may contain an ELSE keyword.
If
the expression
in
the IF statement
is
true (evaluates
to
be non-zero), then the statements
between the THEN and the ELSE keywords are processed.
If
the condition
is
false
(evaluates
to
be zero) then the statements between the ELSE and the end of the line
are processed.
If
the sequence of SuperBASIC statements does not contain an ELSE keyword and
if
•
the expression
in
the IF statement
is
true,
then
the statements between
the
THEN keyword
and the end of the line are processed.
If
the expression
is
false
then processing continues
at
the next
line.
syntax:
statements:
=
statement
*
[:
statement]
*
IF
expression
THEN
statements
[:ELSE
statements]
example:
i.
IF
a:32
THEN
PRINT
"Lim;t"
: ELSE
PRINT
"OK
II
ii.
IF
test>
maximum
THEN
LET
maximum
=
test
iii.
IF
"1"+1=2
THEN
PRINT
"coercion
OK"
long
1 The THEN keyword
is
the last entry on the logical
line.
A sequence of SuperBASIC
statements
is
written following the IF statements. The sequence
is
terminated by the END
IF statement. The sequence of SuperBASIC statements
is
executed
if
the expression
contained
in
the IF statement evaluates
to
be
non
zero.
The ELSE keyword and second
sequence of SuperBASIC statements are optional.
long
2 The THEN keyword
is
the last entry
on
the logical
line.
A sequence of SuperBASIC
statements follows
on
subsequent
lines,
terminated by
the
ELSE keyword. IF the
expression contained
in
the IF statement evaluates
to
be non zero then this
first
sequence
of SuperBASIC statements
is
processed. After the ELSE keyword a second sequence
of
SuperBASIC statements
is
entered, terminated
by
the END IF keyword,
If
the expression
evaluated by the IF statement
is
zero then this second sequence of SuperBASIC
statements
is
processed.
•
26
12/84