ON_ERROR_GOTO

ON_ERROR_GOTO L

IF ERROR, JUMPS TO THE PART OF PROGRAM WHICH BEGINS BY "L:"

  • Type: Command
  • Parameter: 1
  • Group: Reference

ACTION

The command ON_ERROR_GOTO makes program execution jump to the location called "L", if an error occurs.

L is a label and must be defined by the keyword LABEL.

remark:

when an error occurs,

ERROR_LINE contains the source line number which caused the error,

ERROR_NUMBER contains the code of the happened error,

ERROR_TYPE$ contains an explanation of the error.

The explanation is in English by default, but the language can be changed: ERROR_FRENCH for French, ERROR_ENGLISH for English.

SYNTAX: ON_ERROR_GOTO L

  • L : label

USE

  • The command ON_ERROR_GOTO is used to jump to another location if an error occurs.

ERROR

  • If the label L does not exist.
  • If L is not a correct label name.

EXAMPLE

label err

on_error_goto err

top 0, 3+:rem here error

print "never printed"

err:

print "error"

print error_number

print error_type$

print error_line

SEE ALSO

ERROR_ENGLISH

ERROR_FRENCH

ERROR_LINE

ERROR_NUMBER

ERROR_TYPE$