Introduced in the 1977 ANSI M[UMPS] language standard.
WRITE 1 DO SUB WRITE 2
; ... check processing conditions
IF PROBLEMS QUIT
; ... process data
In this example, the value 1 is written, then the subroutine is invoked. The subroutine starts out checking whether all conditions are met that are needed for it to function properly. If not all conditions are met, the first QUIT command is executed, and control reverts back to the calling program, i.e. the command WRITE 2 is executed.
Otherwise, the rest of the subroutine is executed, and the final QUIT command is processed eventually, after which control reverts to the calling routine and the command WRITE 2 is executed.
SET S="" FOR SET
. ; process one occurrence of DATA(S)
In this example, the second QUIT command is very much like the QUIT commands in the previous example, but the first QUIT command, the one on the same line as the FOR command, is used to terminate a loop that would otherwise continue forever.
Addition in the 1990 ANSI M[UMPS] language standard.
ADD(P,Q) QUIT P+Q
In the case of an extrinsic function call, the value to be returned to the calling program is specified as the argument of the QUIT command that returns control back to that calling program.
A() FOR QUIT 1
This example will yield an error (M16) when the command QUIT 1 is encountered in the context of the FOR loop.
SUB(SP,GN) IF SP="Fowl" DO
. IF GN="F" QUIT "Hen"
. ELSE QUIT "Cock"
ELSE QUIT "Don't know"
This example will cause an error (M16) at the command QUIT "Hen".
The indented block is not called as an extrinsic function, and hence cannot return a value.
SET INCOME=250000,DEPENDENTS=3 DO TAX
TAX SET TAX=0 DO
. IF INCOME>5000 DO
. . IF DEPENDENTS>0 QUIT
. . SET TAX=(INCOME-5000)*0.05
. IF INCOME>50000 DO
. . IF DEPENDENTS>2 QUIT
. . SET TAX=TAX+(INCOME-50000)*0.1
. IF INCOME>200000 DO
. . IF DEPENDENTS>4 QUIT
. . SET TAX=TAX+(INCOME-200000)*0.2
Because the number of dependents is 3 (more than 0 or 2), the first two blocks (INCOME>5000 and INCOME>50000) have no effect. The third block adds (250000-200000*.02)=10000 to TAX (which still is 0), so that the amount written will be 10000.
The QUIT commands in the indented blocks with two dots at the start of the line only terminate the 'two dot' level, and return control to the 'one dot' level.
Addition in the 1995 ANSI M[UMPS] language standard.
Argument indirection is allowed to return a value from a
FOR K=1:1:100 QUIT:condition VALUE DO something
An occurrence of a QUIT command with an argument in the scope of a FOR command will cause an error (M16).
Examples with naked references:
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
; Naked indicator is now: ^ABC(1,3,
; Actual reference is: ^ABC(1,3,4)
This document is © Ed de Moel, 1995-2005.
It is part of a book by Ed de Moel that is published under the title "M[UMPS] by Example" (ISBN 0-918118-42-5).
Printed copies of the book are no longer available.
This document describes the various commands that are defined in the M[UMPS] language standard (ANSI X11.1, ISO 11756).
The information in this document is NOT authoritative
and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.
In this document, information is included that will
The MDC cannot guarantee that these 'next' standards will indeed appear.