Routines (alphabetical) > Routines: E > EXIT

# EXIT

The EXIT procedure quits IDL and exits back to the operating system. All buffers are flushed and open files are closed. The values of all variables that were not saved are lost.

See Notes on the EXIT Procedure for more information on this topic.

## Syntax

EXIT [, /NO_CONFIRM] [, STATUS=code]

## Arguments

None.

## Keywords

### NO_CONFIRM

Set this keyword to suppress any confirmation dialog that would otherwise be displayed in a GUI version of IDL such as the IDL Workbench.

### STATUS

Set this keyword equal to an exit status code that will be returned when IDL exits. For example, on a UNIX system using the Bourne shell:

Start IDL:

$ idl

Exit IDL specifying exit status 45:

exit, status=45

Display last exit status code:

$ echo $?

The following displays:

45

## Notes on the EXIT Procedure

In a bash environment (IDL Unix command line), the status code passed to the EXIT procedure goes into the `$?` variable. The supported values of this variable are 0-255. Values outside of this range will wrap to fit within the range.

In a DOS environment (IDL Windows command line), the status code passed to the EXIT procedure goes into the ERRORLEVEL variable. The supported values of this variable are -1073741823 to 1073741823. Values outside of this range will be truncated.

In the IDL workbench environment, the status code passed to the IDL EXIT procedure gets passed back out to the shell that started the `idlde` process, as described above, with 2 important differences:

1. If the status is non-zero (considered an error condition) then a native dialog box is opened showing the error status and the arguments that were passed to the workbench JVM process. This dialog can be suppressed by calling the idlde executable with the argument --`launcher.suppressErrors`.
2. The exit status value of 1 is handled specially by the workbench launcher, causing an automatic restart of the process. In other words, calling `EXIT, STATUS=1` in the IDL workbench will shut down and immediately restart the workbench.

## Version History

Original | Introduced

## See Also

CLOSE, FLUSH, STOP, WAIT