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

GOTO

M[UMPS] by Example

Right Hand Pointer

Introduced in the 1977 ANSI M[UMPS] language standard.

Goto LABEL

Goto LABEL+OFFSET
Note that use of the LABEL+OFFSET syntax may have unintended ramifications when lines of code are inserted between the line with the LABEL and the line that was indicated by LINE+OFFSET before the insertion.

Goto ^PROGRAM

Goto LABEL^PROGRAM

Goto LABEL+OFFSET^PROGRAM

Goto @ARGUMENT

Goto @INDLABEL^PROGRAM

Goto @INDLABEL^@INDPROG

Note: a reference like +OFFSET^ROUTINE is acceptable as a parameter for $Text, but not as an argument for the commands Do and Goto.

Addition in the 1995 ANSI M[UMPS] language standard.

Assume that the following code occurs in a routine called ROUTINE1
 ;...
 Goto LABEL1^ROUTINE2
 ;...
 Do
 . ;...
LABEL3 . ;...
 . If CONDITION Goto LABEL3
 . ;...
 . If CONDITION Goto LABEL3^ROUTINE1
 . ; ...
 . Goto LABEL2^ROUTINE3

The first Goto command will transfer control to LABEL1 in ROUTINE2.
Assuming that no lines of level 1 occur between the argumentless Do command and the further Goto commands, the second Goto command will transfer control to LABEL3 in ROUTINE1, as will the third
Goto command. The fourth Goto command will cause an error (M45).

EXAMPLE Do
 . Goto DEST
DEST Quit

This example will cause an error (M45) to occur. It is not allowed to jump outside of an indented block by means of a Goto command.

Examples with naked references:

Goto DESTINATION
Set ^ABC(1,2)="reset naked indicator"
; naked indicator is now ^ABC(1,
Goto @^(3,4)

; naked indicator is now: ^ABC(1,3,
; Actual reference is: ^ABC(1,3,4)

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 12-Sep-2014, 09:11:23 .

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