next up previous contents index
Next: MACRO: Macro Statements (Subroutines) Up: Control Statements Previous: IF: Conditional Execution   Contents   Index


WHILE: Repeated Execution

Repeated execution can be requested by a WHILE statement. It allows usages similar to the C language while statement:

WHILE (logical) statement;
WHILE (logical) { statement-group; }
Note that all statements must be terminated with semicolons (;), but there is no semicolon after a closing brace. The condition is re-evaluated in each iteration. The statement or group of statements following the WHILE is repeated as long as the condition is satisfied. Of course some variable(s) must be changed within the WHILE group to allow the loop to terminate.



MAD User Guide, http://wwwslap.cern.ch/mad/