28
2. 3 Error processing control
2.3 .1
ON E RROR GOTO
ON E RROR GOTO lr
Format
lr . . . . reference line number : error processing routine
This statement declares the number of the line to which program execution is to
Function
be moved in order to correct errors.
Declaring an error processing routine with the ON E RROR GOTO statement
Description
allows errors to be corrected during p rogram execution without the system re
turning to the BASIC command level. When the ON E RROR GOTO statement is
executed, program execution will be moved to (error processing routine) if any
error has o ccurred. This enables the t error number ( ERN) and the number of the
line on which the error occurred (E RL) to be ascertained, and allows subsequent
processing to be performed in accordance with the IF E RN or ERL statements.
The RESUME statement serves to move program execution back to the point at
which the error occurred.
Execution of a new ON E RRO R GOTO statement invalidates any preceding one.
2.3 .2 I F E RN
IF ERN expression THEN lr
Format
I F E RN expression THEN statement
IF ERN expression GOTO lr
lr . . . . ref erence line number
This statement ascertains the identification numbers of errors, and causes branch
Function
ing when those numbers are ones specified.
When an error o ccurs, the corresponding error number is placed in system variable
Description
ERN. This enables an IF E RN statement in an error correcting routine declared
by the ON ERROR GOTO statement to determine what type of error has
occurred. The IF E RN statement may be used in either of the following forms;
either of the following forms:
( 1 ) IF < relational expression of ERN > GOTO, or
( 2) I F < relational expression of E RN > THEN statement or lr .
(See the descriptions of the IF � THEN and IF � GOTO statements.)
t For the error number, refer to the Error Message Table on page 66.