Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?

Quit Command

Below you can see an example of a simple routine. The last line contains a single command: Quit. You use this command to terminate execution of a routine. You can place Quit in many places throughout a routine, so that certain conditions trigger the Quit. It doesn't have to appear only at the end.

This form of Quit has no arguments (later on we'll see Quit with arguments), so always leave 2 spaces after this command.

hello ; hello world routine
    write !, "hello world"
    write !, "bye"
end quit  ; end

Quit also has a use outside of a routine. While you're writing a routine, Studio will alert you to syntax errors as you type. But runtime errors, such as an undefined variable, will terminate the execution of your routine. You will see the error message, along with the line (label name plus any offset) containing the error, in the Terminal window. In addition, the SAMPLES> prompt will change to something like this: SAMPLES 2d0>. There is significance to the new prompt, but for now, just enter Q (for Quit) to return the prompt to its normal state.

SAMPLES>do ^badroutine

write c
<UNDEFINED>start+3^badroutine *c
SAMPLES 2do>quit