ON
...
GOTO
I ON expression GOTO line,
•..
Statement I
Goes to the line specified
by
the value of expression.
Expression
is
a numeric expression between 0 and 255.
This statement is very similar
to
ON
...
GOSUB. However, instead of
branching to a sUbroutine, it branches control to another program line.
The value of
expression determines
to
which line the program will
branch. For example, if the value is four, the fourth line number
in
the
list is the destination of the branch. If there
is
no
fourth line number,
control passes to the next statement
in
the program.
If the value of expression
is
negative or greater than 255,
an
"Illegal
function call" error occurs. Any amount of line numbers may be
included after GOTO.
Example
ON
MI
GOTO
150, 160,
170,
150,
180
tells BASIC
to
"Evaluate MI;
if the value of
MI
equals one then go to line 150;
if it equals two, then go to 160;
if it equals three, then go to 170;
if it equals four, then go to 150;
if it equals five, then go to 180;
if the value of
MI
doesn't equal any of the numbers one through five,
advance
to
the next statement
in
the program".
2-134