☜ | FOR1995 Version of ANSI (Equivalent to Current ISO Version) of Standard | ☞ |
For | │ │ │ |
[ SP ] SP lvn = forparameter |
│ │ │ |
forparameter | ::= | │ │ │ │ |
expr numexpr1 : numexpr2 : numexpr3 numexpr1 : numexpr2 |
│ │ │ │ |
The scope of the For command begins at the next command following the For on the same line and ends just prior to the eol on this line.
The For with arguments specifies repeated execution of the commands within 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 commands in the scope is specified as follows. (Note that A, B, and C are hidden temporaries.)
If the For command has no argument:
Note that form d. and the argumentless For, specify endless loops. Termination of these loops 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 commands of the outer For encompasses all executions of the scope of commands of the inner For corresponding to one complete pass through the inner For command’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 innermost For whose scope contains the Quit.
Execution of Goto effects the immediate termination of all For commands in the line containing the Goto, and it transfers execution control to the point specified. Note that the execution of a Quit within the scope of a For does not affect the variable environment, e.g., stacked New frames are not removed or processed.
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)