NAME

error - simulate occurrence of a run-time error

SYNOPSIS

error NumExpr

DESCRIPTION

The error statement is used to cause the occurrence of a run-time error.  The argument NumExpr specifies the number of the error which is to occur.  If the value of NumExpr is the same as an error code used by Basmark QuickBASIC, the error statement simulates the occurrence of that error.  If an error handling routine has been previously defined by the on error statement, the error routine is entered.  Otherwise, the appropriate error message is displayed and execution halts.  See the first example below. 

If the value of NumExpr is not an error code used by Basmark QuickBASIC, it is considered to be a user-defined error code.  A user-defined error code may be tested in an error-handling routine just like any other error.  See second example below. 

EXAMPLE

The first example simulates a "Division by zero" error.  The program
	   t = 11
	20 error t
produces
	Division by zero in line 20
The next example is a part of a program that requests the userís age.  By using an error code of 235, which Basmark QuickBASIC doesnít use, the program traps the error if the response is absurd. 
	10 on error goto 40
	20 input "what is your age"; x
	30 if x > 100 or x < 3 then error 235
		.
		.
		.
	40 if err = 235 then print "and chickens have lips"

SEE ALSO

err, erl, on error, resume

DIAGNOSTICS

A user-defined error code with no error-handing routine will cause an "Unprintable error" to occur and execution to halt. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber