Introduced in the 1977 ANSI M[UMPS] language standard.
IF A=5 SET B=3 WRITE "..."
The most common method to make several actions dependent on one
test.
IF (A>5)&(A<16) WRITE
"6 value 15"
IF A>5 IF A<16 WRITE "6 value 15"
IF A>5,A<16 WRITE "6 value 15"
The above three lines have practically the same effect. All three
test whether or not the value of a local variable is between two
values, and write a message if this is the case. In the first
example, however, the test A<16 is also evaluated
when A<5, whereas in the other two cases, because the
first IF command on the line was unsuccessful, the rest of the
line was already being skipped.
There is no difference between the second and third line, other
than that the third line is more compact.
The advantage of not evaluating expressions if an earlier test in
the same line yielded a false result may become obvious in
cases like:
IF X=3,^|"FARAWAY"|GLOBAL(1,2,3) DO
ACTION
By putting the 'simple' test at the beginning of the line,
transactions across the network may be prevented in those cases
where there is no need to execute them.
Examples with naked references:
IF VALUE
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
IF ^(3,4)
; 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
appear in
future standards.
The MDC cannot guarantee that these 'next'
standards will indeed appear.