EasyManua.ls Logo

Apple IIe - Page 128

Apple IIe
320 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
128
Apple
lie
Users
Handbook
ON
Applesoft
o
Integer
The
ON
statement
is
used
in
conjunction
with
GOTO
and
I
GOSUB. The statements are used
to
branch
program
control
to
one
of
several
program
lines
depending
on
the
value
appearing
after
ON
.
Configuration
ON
exp
GOTO
line
[,line
... ]
ON
exp
GOSUB
line
[,line
... ]
exp can be any
numeric
constant
or
numeric
expression.
line
is
the
line
number
the
program
is
to
branch to.
The value
of
exp
controls
which
line
is
to
be
branched
to. For
instance,
if
exp
evaluates
to
1,
program
control
will
branch
to
the
line
number
given
in
the
first
line
..
lf
exp evaluates
to
2,
program
control
will
branch
to
the
second
line
, etc.
..
If
the
ON
.
..
GOSUB statement
is
being
used,
the
line
number
specified
in
line
must be
that
of
a
subroutine.
In
other
words,
a
RETURN
statement
eventually
will
have
to
be
executed
to
return
program
control.
If
exp
evaluates
to
zero
or
to
a
number
greater than
the
number
of
lines specified after
GOTO
or
GOSUB,
the
program
will
continue
with
the
next executable statement.
Example
10
INPUT "ENTER A NUMBER
BETWEEN
1AND4
";I
20
ON
I
GOTO
60,80,100,120
30
PRINT
40
INPUT
"PLEASE
ENTER
A NUMBER
BETWEEN
1
AND
4
";I
50
GOTO
20
60
PRINT
"YOU
ENTERED
A
ONE"
70
GOTO
130
program
co
ntinued on
the
next pa
ge

Other manuals for Apple IIe

Related product manuals