statement/TRAP statement/TRAP
NAME
TRAP -- Turns on or off error interception
ABBREVIATION
t <shift> R
SYNOPSIS
TRAP [<line>]
FUNCTION
When turned on, TRAP intercepts all error conditions (including the
<run/stop> key) exept "UNDEF'D STATEMENT ERROR". In the event of any
execution error, the error flag is set, and execution is transferred to
the line number named in the TRAP statement (<line>). The line number in
which the error occured can be found by using the system variable EL.
The string function ERR$(ER) gives the error message corresponding to
any error condition ER.
TRAP with no line number argument turns off error TRAPping.
INPUTS
<line> - BASIC line number where program execution should continue when
an error occures
RESULT
When line number has been given turns on error interception, otherwise
turns it off.
EXAMPLES
200 TRAP 210
210 PRINT "AN ERROR OCCURED IN LINE"EL".":STOP
NOTES
An error in a TRAP routine cannot be trapped. The RESUME statement can
be used to resume execution.
BUGS
None
SEE ALSO
EL
ER
ERR$()
RESUME