ON ERROR GOTO int-exp

When an error occurs, BASIC will automatically jump to the line number specified by int-exp. If intexp evaluates to zero (or the line number specified by int-exp does not exist), normal error messages will be re-enabled and any previous ON ERROR GOTOs will be cancelled. When an error is trapped, the ON ERROR status is cancelled and must be re-enabled to provide further protection. If an error occurs and is trapped by an ON ERROR, it is not possible to CONTinue execution.

Program Example.

00100 ON ERROR GOTO 100
00110 CLS : HIRES
00120 PLOT 255,127 TO INT(RND * 512),INT(RND*255)
00130 GOTO 120

A BASIC computer will run out of graphics memory eventually and execute the ON ERROR.

Try it

See also ERRORL, ERRORC.