☜ | IFM[UMPS] by Example | ☞ |
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)
Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.
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 14-Nov-2023, 21:10:36.
For comments, contact Ed de Moel (demoel@jacquardsystems.com)