☜ | FOR1984 Version of ANSI Standard | ☞ |
forparameter | ::= | │ │ │ │ |
expr1 numexpr1 : numexpr2 : numexpr3 numexpr1 : numexpr2 |
│ │ │ │ |
The "scope" of this FOR command begins at the next command following this FOR on the same line and ends just prior to the eol on this line.
FOR specifies repeated execution of its scope for different values of the local variable lvn, under successive control of the forparameters, from left to right. Any expressions occurring in lvn, such as might occur in subscripts or indirection, are evaluated once per execution of the FOR, prior to the first execution of any forparameter.
For each forparameter, control of the execution of the scope is specified as follows. (Note that A, B, and C are hidden temporaries.)
Note that form d. specifies an endless loop. Termination of this loop must occur by execution of a QUIT or GOTO within the scope of the FOR. These two termination methods are available within the scope of a FOR independent of the form of forparameter currently in control of the execution of the scope; they are described below. Note also that no forparameter to the right of one of form d. can be executed.
Note that if the scope of a FOR (the "outer" FOR) contains an "inner" FOR, one execution of the scope of the outer FOR encompasses all executions of the scope of the inner FOR corresponding to one complete pass through the inner FOR’s forparameter list.
Execution of a QUIT within the scope of a FOR has two effects.
In other words, execution of QUIT effects the immediate termination of the innnermost FOR whose scope contains the QUIT.
Execution of GOTO effects the immediate termination of all FORs in the line containing the GOTO, and it transfers execution control to the point specified.
See also the transition diagram for For.
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.
This page most recently updated on 09-Jan-2024, 15:14:56.
For comments, contact Ed de Moel (demoel@jacquardsystems.com)