Sharp PC-1403 Operation Manual page 163

Hide thumbs Also See for PC-1403:
Table of Contents

Advertisement

157
An input
of
1
prints "FIRST"; 2prints
"SECOND";3
prints "THIRD".
Any other input
does not
produce
any
print.
10
INPUT
A
20 ON A GOSUB
100, 200,
300
30 END
100 PRINT "FIRST"
110
RETURN
200 PRINT
"SECOND"
210 RETURN
300 PRINT
"THIRD"
310
RETURN
Examples
*'Ml
When
the
ON
...
GOSUB
verb is
executed,
the
expression
between
ON and GOSUB
is evaluated
and reduced to
an
integer.
If
the
value
of the
integer
is
1,
the first
subroutine in the
list is executed as in a normal
GOSUB.
If the expression
is
2, the
second
subroutine
in
the
list
is
executed,
and
so
forth.
After the
RETURN from the
subroutine,
execution
proceeds with the statement
which follows
the
ON
...
GOSUB.
If
the expression is
zero, negative,
or
larger
than
the number of subroutines provided
in the list, no subroutine is
executed
and
execution proceeds
with the next line of the
program.
NOTE: Commas
cannot
be
used in the
expressions
following the GOSUB.
The
COMPUTER
cannot
distinguish
between
commas
in expressions
and com-
mas between
expressions.
The ON
...
GOSUB
verb is
used to execute
one of
a
set
of
subroutines
depending on
the value of
a control
expression.
Abbreviations:
O.;
GOS.,
GOSU.
See
also: GOSUB, GOTO,
ON
...
GOTO
1
ON
expression GOSUB expression list
Where: expression
list
is:
expression
or: expression,
expression
~ist
Verbs
ON ... GOSUB

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents