Next: Blocks Up: The Language Previous: IF - THEN

### WHILE - Instruction :

           WHILE ( numeral or numeral formula )
           {
              any sequence of commands
           }

If the result of the expression in brackets is different from 0, the commands in the block are executed one after the other.

At the end of the block the condtion is checked anew. If the result is still different from 0, the program jumps to the beginning of the block and executes the commands one after the other. This procedure is repeated as long as the condition is not fulfilled anymore.

Attention !

If objects in the loop are named with their IDs, these objects may not be deleted within the loop. Even calling the objects with their names does not avoid the loop to abort.

Example :

           WHILE ( VAR1 > 10 )
           {
              ...
              CREATE VAR N 20 ; NA = VAR2 !
              DELETE VARIABLE VAR1 !
              MODIFY VARIABLE N VAR2 ; NA = VAR1 !
           }

The loop is interrupted with an error after the first turnaround, because variable VAR1 has been deleted; its object ID (i.e. type and number of variable) has been noted as a loop consition. Even renaming VAR2 into VAR1 cannot prevent the abort.