ABORT statement

Syntax

ABORT [expression ...]
ABORTE [expression ...]
ABORTM [expression ...]

Description

Use the ABORT statement to terminate execution of a BASIC program and return to the command prompt. ABORT differs from STOP in that a STOP statement returns to the calling environment (for example, a menu, a paragraph, another BASIC program following an EXECUTE statement, and so on), whereas ABORT terminates all calling environments as well as the BASIC program. You can use it as part of an IF...THEN statement to terminate processing if certain conditions exist.

If expression is used, it is printed when the program terminates. If expression evaluates to the null value, nothing is printed.

The ABORTE statement is the same as the ABORT statement except that it behaves as if $OPTIONS STOP.MSG were in force. This causes ABORT to use the ERRMSG file to produce error messages instead of using the specified text. If expression in the ABORTE statement evaluates to the null value, the default error message is printed:

Message ID is NULL:  undefined error

For information about the ERRMSG file, see the ERRMSG statement.

The ABORTM statement is the same as the ABORT statement except that it behaves as if $OPTIONS -STOP.MSG were in force. This causes ABORT to use the specified text instead of text from the ERRMSG file.

Example

PRINT "DO YOU WANT TO CONTINUE?":
INPUT A
IF A="NO" THEN ABORT

This is the program output:

DO YOU WANT TO CONTINUE?NOProgram "TEST": Line 3, Abort.