- ~~~~~~~
- ~~~~~~~
- ENDDO
Where:
1. <REG> is a loop index variable where the value of the index is
accumulated. (SPIDER still accepts an earlier syntax
where <REG> was a single letter (a...z or A..Z) which
denotes the loop index).
2. <LOWER> is a integer constant that specifies the lower bound of
the loop index.
3. <UPPER> is a integer constant that specifies the upper bound of
the loop index.
4. <INCREMENT> is an optional integer constant that
specifies an incremental value that is added to the loop index
with each cycle of the loop. Default value for
<INCREMENT> is 1.
EXAMPLE:
- DO [imgnum]=5,17
- ~~~~~~~
- ~~~~~~~
- ENDDO
In the above example, DO will repeat any operations (~~~~~)
with the loop index variable [imgnum] varying from 5 to 17.
Nesting of DO loops is allowed. For example:
- DO [xval]=2,3
- ~~~~~~~
- ~~~~~~~
-
- DO [yval]=5,15,5
- ~~~~~~~
- ~~~~~~~
- ENDDO
- ~~~~~~~
- ~~~~~~~
- ENDDO
will perform the operations within the initial loop 2 times,
and the operations within the enclosed loop a total of 6 times.
NOTES
- When nesting DO loops, make sure that different registers are used for <REG>.
- DO loops may be nested up to a maximum of MAXPRC deep.
See: 'CMLIMIT.INC
for current value of MAXPRC.
- Any number of operations may appear between 'DO' and 'ENDDO'.
- The lower, upper bounds, and increment of the 'DO LOOP' operation may
be either string or register variables. For example:
DO [image] = [start],[end],[incr]
is allowed where: [start] = '1'.
We advise against using non-integers for
these values as their usage may vary in the future.
- Prior to SPIDER release 15.0, 'DO' loops were terminated with
a label operation 'LB'.
This label had to be specifed when
invoking the loop. This syntax is found in
older SPIDER procedures and is still supported but is
now deprecated. Example:
- DO LB4 [num]=1,9
- SH
- ALL{***[num]}
- SHI{***[num]}
- (15, 8)
- LB4
- More information on DO-loops.
- In legacy SPIDER procedures the default interpretation of input
values to operations within a 'DO LOOP' was that values NOT enclosed in sets
of '()' were applied over successive steps of the loop. This was a confusing
feature, and should never have been part of SPIDER. See the
user guide for
an explanation of this capability and the current method how to apply
differing values on successive steps of the DO LOOP. It is simpler to just
ignore this capability since one rarely needs to apply such a limited set of
different values on successive steps within a DO LOOP.
- SUBROUTINES
- SPIDER, FINDLBQ, GETLBNO
- CALLER
- SPIDER