bas7advr.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
ERR Statement Details
◄Syntax► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Sets ERR to a specific value.
ERR = n%
Usage Notes
■ When running an application program, BASIC uses ERR to record whether
or not a run-time error has occurred and what the error was. When the
program starts running, ERR is 0; when and if a run-time error
occurs, BASIC sets ERR to the error code for that error.
■ You may want to use the ERR statement to set ERR to a non-zero value
to communicate error information between procedures. For example, you
might use one of the run-time codes not used by BASIC as an
application-specific error code. See Table 4.1, Run-Time Error
Codes, in the BASIC Language Reference, for a list of the run-time
error codes that BASIC uses; they are a subset of the integers
between 1 and 255, inclusive.
■ Besides the ERR statement, the following BASIC statements set ERR
whenever they execute:
- Any form of the RESUME statement sets ERR to 0.
- EXIT SUB, EXIT FUNCTION, or EXIT DEF set ERR to 0 if executed
within a procedure-level error handler.
- All uses of the ON ERROR or ON LOCAL ERROR statements syntax
set ERR to 0.
- The ERROR statement can be used to set ERR to any value as
part of simulating any run-time error.