Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples
Left Hand Pointer

THEN

M[UMPS] by Example

Right Hand Pointer

Approved for inclusion in a future M[UMPS] Language standard.

The command THen stacks the value of special variable $Test. This value will be "popped" off the stack when execution moves to a different line of code (either through a Goto command, or when the end of the current line is reached).

Assume that the code segment below is executed.

 For A=1,0 Do
 . If A Write !,"TRUE 1" If 0
 . Else  Write !,"FALSE 1"
 . If A THen  Write !,"TRUE 2" If 0
 . Else  Write !,"FALSE 2"
 . Quit

At the first iteration of the For loop, the value of A is true (1). The first If command will cause the text "TRUE 1" to be written, and the second If command on that line will cause the value of special variable $Test to be set to 0 (false). As a result, on the next line, the Else command will cause the text "FALSE 1" to be written.

The next If command will cause the text "TRUE 2" to be written, and this time, the THen command will stack the value of $Test (which is at this point equal to 1). After this, the second If command on that line will cause the value of special variable $Test to be set to 0 (false). At this point, the end of the line is reached, and the value of $Test will be popped off the stack, setting it back to 1 (true). As a result, on the next line, the Else command will cause the rest of that line to be ignored.

At the second iteration of the For loop, the value of A is false (0). The first If command will cause the rest of that line to be ignored, and, on the next line, the Else command will cause the text "FALSE 1" to be written.

The next If command will also cause the rest of that line to be ignored, and, on the next line, the Else command will cause the text "FALSE 2" to be written.

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2017 MUMPS Development Committee;
Copyright © Examples: 1995-2017 Ed de Moel;
Copyright © Annotations: 2003-2017 Jacquard Systems Research.

The information in this page is NOT authoritative and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.

Some specifications are "approved for inclusion in a future standard". Note that the MUMPS Development Committee cannot guarantee that such future standards will indeed be published.

This page most recently updated on 22-Jan-2005, 13:11:10 .

For comments, contact Ed de Moel (demoel@jacquardsystems.com)