### 5.2.15 while

`Syntax:`
  `while (`boolean_expression`)` block
`Purpose:`
  repetitive, conditional execution of block.
  The boolean_expression is evaluated and if its value is TRUE, the block gets executed. This is repeated until boolean_expression evaluates to FALSE. The command `break` leaves the innermost `while` construction.
`Example:`

      int i = 9;
      while (i>0)
      {
         // ... // do something for i=9, 8, ..., 1
         i = i - 1;
      }
      while (1)
      {
         // ...   // do something forever
         if (i == -5) // but leave the loop if i is -5
         {
           break;
         }
      }

See Control structures; boolean expressions; break.

User manual for Singular version 4.4.1, 2025, generated by texi2html.