EasyManua.ls Logo

Sharp MZ-700 - Other Statements

Sharp MZ-700
213 pages
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...
2.10
.Other Statements
2.1
0.1
ON
ERROR GOTO
............................
(Abbreviated format: ON ERR. G.)
.-I
_F_o_r_m_a_t---,1
Function
ON
ERROR
GOTO
Lr
Lr
....
Destination line
number
(entry
point
of
an error processing
routine)
This statements causes execution
to
branch
to
line
number
Lr
if
an error occurs.
The
IF ERN and
IF
ERL
statement
can be used in a trap
routine
starting
at
that
line
to
control subsequent processing according
to
the type
of
error and the line
number
in which it occurred. Including a RESUME
statement
at
the end
of
the
error
pro-
cessing routine makes
it
po
.ssible
to
return execution
to
the
line
at
which the
error
occurred. Executing an ON
ERROR
GOTO
statement
cancels the
error
trap line
number
definied by the previous ON
ERROR
GOTO statement. The
error
trap line
number definition is also cancelled by executing a CLR statement.
2.1
0.2 IF ERN
I Format I
IF
relational expression using
ERN
THEN
Lr
Function
Example
IF
relational expression using ERN THEN
statement
IF
relational expression using ERN GOTO Lr
Lr
....
Destination line
number
This
statement
branches execution
to
the error processing (trap) routine starting
at
line Lr
or
executes
the
statement
following THEN when the result
of
<relational
expression using
ERN>
is
true.
ERN
is a special function which returns a
number
corresponding to
the
type
of
error
occurring. See page 159 for
the
error numbers. ·
The
following shows an
error
processing routine beginning
on
line 1000 which causes
execution
to
branch
to
line 1200
if
the
error
number
is
5.
1 0
ON
ERROR
GOTO
1
000··
······Declares
the
line
number
of
the
error
processing routine.
1
000
IF
ERN=5
THEN
1
200·········Branches
to
1200
if
a string
overflow error has occurred.
96
----------------------------------
--
------------
----
--
------------
---

Other manuals for Sharp MZ-700

Related product manuals