
Commands - 82
ON
Statement
SYNTAX: ON expression GOSUB line [,line] ...
ON expression GOTO line [,line] ...
PURPOSE: In the ON. .. GOT O statement, the value of the expression deter mines which line num ber in the list
will be used for branching. For example, if the value is 3, the third line number in the list will be
the destination of the branch.
NOTE: You may not use labels with this statement.
REMARK S: In the ON...GO SUB statement, each line number in the list must be the first number of a subroutine.
line must be a number and not a variable. Maximum number of line parameters is limited by the
number of characters you can put in a line. For simplicity, no more than 5 line parameters should be
used on any one program line.
If the value of expression is zero or greater than the number of line parameters, the stateme nt is
ignored.
RELATED: RETURN
EXAMPLE: 200 ON R GOTO 150,300,320,390
If R= 1, the program goes to line 150
If R= 2, the progr am br anches to line 30 0 and continues from there. If R= 3, the branch will be to
line 320 and so on.
ERROR: < Can’t compile> – if line does not exist
< Data negative> – for expression
< Data > 255> – for expression
Commenti su questo manuale