Flow-control structures: Difference between revisions

Content added Content deleted
m (→‎XECUTE / X: repeated SET command to increase clarity)
Line 634: Line 634:
<p>Jumps to a label.This does not affect the stack, only the program pointer.</p><lang MUMPS>GOTO THERE</lang>
<p>Jumps to a label.This does not affect the stack, only the program pointer.</p><lang MUMPS>GOTO THERE</lang>
===HALT / H===
===HALT / H===
<p>Halt and Hang have the same abbreviation, but (as a mnemonic) Halt takes no arguments. Halt stops the current process, and clears all Locks and devices in Use. If the $HALT special variable is set, that routine is called before cleaning up (in effect, a specialized error trap).</p>
<p>Halt and Hang have the same abbreviation, but (as a mnemonic) Halt takes no arguments. Halt stops the current process, and clears all Locks and devices in Use.
On the Cache variant of MUMPS, there is a $HALT special variable that can be set, the value of the $HALT special variable is a routine that is called before cleaning up (in effect, a specialized final error trap).</p>
<lang MUMPS> Read "Do you really wish to halt (Y/N)?",Q#1
<lang MUMPS> Read "Do you really wish to halt (Y/N)?",Q#1
IF Q="Y"!Q="y" HALT</lang>
IF Q="Y"!Q="y" HALT</lang>

===QUIT / Q===
===QUIT / Q===
<p>Exits a loop, or routine. It decreases the stack level. It can return a value to a calling routine if there is a value after it.</p><p>Quit is one of the commands that requires two spaces after it if it is followed in a line by more commands.</p>
<p>Exits a loop, or routine. It decreases the stack level. It can return a value to a calling routine if there is a value after it.</p><p>Quit is one of the commands that requires two spaces after it if it is followed in a line by more commands.</p>