BASIC commands
PROGRAMMING MANUAL
119
Revi
si
on 3.0
3.2.194 ON
/i
3.2.195 ON.. GOSUB
/i
3.2.196 ON.. GOTO
/i
3.2.197 OP
/i
Type
Constant (read-only)
Syntax
ON
Description
The
ON
constant returns the numerical value 1.
Arguments
N/A
Example
OP (lever,ON)
The above line sets the output named lever to
ON
.
See also
N/A
Type
Program control command
Syntax
ON expression GOSUB label { , label }
Description
The
ON..GOSUB
and
ON..GOTO
structures enable a conditional jump. The
integer expression is used to select a label from the list. If the expression has
value 1 the first label is used, for value 2 then the second label is used, and
so on. Once the label is selected, subroutine
GOSUB
jump to that label is
performed.
Note: If the expression is not valid, no jump is performed.
Arguments
•
expression
Any valid BASIC expression.
•
label
Any valid label in the program.
Example
REPEAT
GET#5,char
UNTIL 1<=char and char<=3
ON char GOSUB mover, stopper, change
See also
GOSUB..RETURN
,
GOTO
.
Type
Program control command
Syntax
ON expression GOTO label[,label[,...]]
Description
The expression is evaluated and then the integer part is used to select a label
from the list. If the expression has the value 1 then the first label is used, 2
then the second label is used, and so on. If the value of the expression is less
than 1 or greater than the number of labels then an error occurs. Once the
label is selected, subroutine
GOTO
jump to that label is performed.
Arguments
•
expression
Any valid BASIC expression.
•
label
Any valid label in the program.
Example
REPEAT
GET #1,char
UNTIL 1<=char and char<=3
ON char GOTO mover,stopper,change
See also
N/A
Type
I/O command
Syntax
OP(output_number, value)
OP(binary_pattern)
OP
I52E-EN-03.book Seite 119 Freitag, 29. Juni 2007 11:55 11