Examples of Quit

Example:

        DO A
        QUIT
        A WRITE !,"This is label A"
        

The explicit QUIT at the line preceding the label A prevents line A from executing twice. The sub-routine at line A terminates with the implicit QUIT at the end of the routine.

Example:

        WRITE $$ESV
        QUIT
        ESV()
        QUIT "value of this Extrinsic Special Variable"
        

Because the label ESV has an argument list (which is empty), GT.M can only legally reach that label with a extrinsic invocation. The QUIT on the second line prevents execution from erroneously "falling through" to the line labelled ESV. Because ESV identifies a subroutine that implements an extrinsic special variable, the QUIT on the line after ESV has an argument to provide the value of the extrinsic.

Example:

          SET x="" F S x=$O(^BAL(x)) Q:x]]"AR5999"!'$L(x) D STF
        

The postconditional QUIT terminates the FOR loop.