EasyManua.ls Logo

Sharp MZ-800 - Page 74

Sharp MZ-800
221 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...
ON~GOTO
Format
Explanation
See
also
ON
<numerical
expression>
GOTO
{
<line
number>
[,<line
number>]
...
<label>
[,<label>]
...
Abbreviated
Format
ON~G,
The
ON
~
GOTO
statement
branches
execution
to
one
of
the
line
numbers
follow-
ing
GOTO,
depending
on
the
value
of
<numeric
expression>.
The
value
of
<numeric
expression
>
indicates
which
of
the
line
numbers
following
GOTO
will
become
the
branch
destination.
Therefore,
if
<numeric
expression>
is
1,
execu-
tion
branches
to
the
first
line
number
in
the
list;
if
<numeric
expression>
is
2,
execution
branches
to
the
second
line
number
in
the
list,
etc.
For
example:
100
ON
A
GOTO
200,300,400,500
Destination
when
A
is
1
=
line
200
A
is
2
=
line
300
A
is
3
=
line
400
Ais
4
=
line
500
10
INPUT''NUMBER"’;A
20
ON
A
GOTO
50,60,70
30
GOTO
10
50
PRINT
‘’XXX""
:
GOTO
10
60
PRINT
“*YYY’
:
GOTO
10
70
PRINT
‘’ZZ2Z''
;
GOTO
10
RUN
NUMBER
1
XXX
NUMBER
2
YYY
NUMBER
If
a
decimal
number
such
as
1.2
is
specified,
the
decimal
fraction
is
truncated
be-
fore
the
statement
is
evaluated.
Note:
When
the
value
of
<numeric
expression>
in
an
ON~
GOTO
statement
is
greater
than
the
number
of
line
numbers
specified
following
GOTO,
execution
continues
with
the
next
line
of
the
program.
This
also
applies
if
the
value
of
<numeric
expression
>
is
less
than
|
or
negative.
Further,
if
the
value
of
<numeric
expression>
is
a
non-integer,
the
decimal
frac-
tion
is
truncated
to
obtain
an
integer
value
before
the
statement
is
evaluated.
GOTO
ON
GOSUB

Other manuals for Sharp MZ-800

Related product manuals