QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The ERROR statement is used to simulate a program error or to troubleshoot error handling procedures.

Syntax

ERROR codeNumber%

Description

Example(s)

Creating custom error codes for a program that can be handled by an ON ERROR handling routine.


ON ERROR GOTO handler

IF x = 0 THEN ERROR 123
x = x + 1
IF x THEN ERROR 111

END

handler:
PRINT ERR, _ERRORLINE
BEEP
RESUME NEXT 

Note: Don’t use error codes under 97 or over 200 as QB64 may respond to those errors and interrupt the program.

See Also