CERN home page CERN home page Consult pages Consult pages Writeups at CERN Writeups at CERN Garfield pages Garfield pages Help Help This page This page Table of contents Keyword index

Do_loop


FOR

If you use FOR in the first line of a DO loop, you request a loop variables (var) to be incremented at each iteration of the loop. Hence you have to specify the name of the variable, its initial value, the increment and the final value.

var

The name of the variable to be incremented at each iteration. You may also change the value of this variable during the loop yourself.

This string should start with an alphabetic character, be at most 10 characters long and should not contain separators, algebraic operators or parentheses (see naming for a complete list of restrictions on the names of global variables).


from

The initial value of the loop variable. This may be an expression in terms of global variables.

step

The increment of the loop variable. The increment may assume positive and negative values but also 0.

This expression is evaluated anew each iteration.

If no step size is indicated, a default value of 1 is assumed.


to

For positive increments, the loop is left as soon as the loop variable exceeds this value. For negative increments, the loop is left as soon as the variable is less than to.

This expression is evaluated anew each iteration.


while

The while condition is evaluated after the loop variable, if used, has been incremented and before a new iteration begins. You have to ensure that while is assigned a value before you execute the loop. Iteration is left as soon as the condition fails to hold.

This expression is evaluated anew each iteration.


until

The until condition is evaluated at the end of each iteration and does not need to have a value before the DO loop. The loop variable is incremented for the next cycle before until is calculated. Iteration is left as soon as the condition holds.

LEAVE

Causes iteration to stop, no matter the WHILE, UNTIL and TO conditions.

You may specify as an argument the name of the loop variable associated with the loop you wish to leave.


ITERATE

Causes the remaining part of this pass through the loop to be skipped. Execution resumes at the top of the loop.

You may specify as an argument the name of the loop variable associated with the loop you wish to leave.


Go to the top level, to Do_loop, to the topic index or to the table of contents.

Formatted on 0099-12-08 at 15:53.