$QUIT (ObjectScript)
Synopsis
$QUIT
$Q
Description
$QUIT contains a value that indicates whether an argumented QUIT command is required to exit from the current context. If an argumented QUIT is required to exit from the current context, $QUIT contains a one (1). If an argumented QUIT is not required to exit from the current context, $QUIT contains a zero (0).
In a context created by issuing a DO or XECUTE command, an argumented QUIT is not required to exit. In a context created by a user-defined function, an argumented QUIT is required to exit.
This special variable cannot be modified using the SET command. Attempting to do so results in a <SYNTAX> error.
Example
The following example demonstrates $QUIT values in a DO context, in an XECUTE context, and in a user-defined function context.
The sample code is as follows:
QUI
DO
. WRITE !,"$QUIT in a DO context = ",$QUIT
. QUIT
XECUTE "WRITE !,""$QUIT in an XECUTE context = "",$QUIT"
SET A=$$A
QUIT
A()
WRITE !,"$QUIT in a User-defined function context =",$QUIT
QUIT 1
A sample session using this code might run as follows:
USER>DO ^QUI
$QUIT in a DO context = 0
$QUIT in an XECUTE context = 0
$QUIT in a User-defined function context = 1
$QUIT and Error Processing
The $QUIT special variable is particularly useful during error processing when the same error handler can be invoked at context levels that require an argumented QUIT and at context levels that require an argumentless QUIT.
See the Using Try-Catch for more information about error processing.