ERR and ERL Variables

Basic Computer Programming Language Command Set


To return the error code (ERR) and line number (ERL) associated with an error.




The variable ERR contains the error code for the last occurrence of an error.

The variable ERL contains the line number of the line in which the error was detected.

The ERR and ERL variables are usually used in IF-THEN, or ON ERROR...GOTO, or GOSUB statements to direct program flow in error trapping.

If the statement that caused the error was a direct mode statement, ERL will contain 65535. To test if an error occurred in a direct mode statement, use a line of the following form:

IF 65535=ERL THEN ...

Otherwise, use the following:

10 IF ERR=error code THEN...GOSUB 4000
20 IF ERL=line number THEN...GOSUB 4010


If the line number is not on the right side of the relational operator, it cannot be renumbered by RENUM.

Because ERL and ERR are reserved variables, neither may appear to the left of the equal sign in a LET (assignment) statement.

Basic commands