Community QBasic

Rebooting the QBasic we all know and love!


Project maintained by Cory Smith

ERROR

Simulates an occurrence of the error number specified. Allows a program to define its own error codes.

Syntax

ERROR numeric_expression

Comments

numeric_expression is an integer value in the range of 1 to 255.

See the Error Codes for a list of predefined error status codes. To define your own error, use an undefined error value.

The ERROR statement assigns the error value specified to ERR and passes control to the error handler.

Examples

ON ERROR GOTO Handler

' Test error handler with error 222
ERROR 222

EndTest:
  END

Handler:
  PRINT "In error handler with error"; ERR
  RESUME EndTest

See Also