Parameter PassingΒΆ

Material prepared from M Programming Book [WALTERS1997]

Page 193-196

Parameter passing in MUMPS is similar to any modern language (since the 1990 specification):

<calling the function>
SET NUM = 18
DO ^%MYTASK(NUM)
<this will jump to the function with NUM as the argument>



<function>
%MYTASK(NUM)
WRITE NUM,!

If the name of the variable in the call matches the name of the variable in the function, the original variable will be modified if the subroutine changes it. If the name is different, it will retain the original value no matter what the function does.