Top
Back: return
Forward: ~
FastBack: Functions
FastForward: System variables
Up: Control structures
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

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.


Top Back: return Forward: ~ FastBack: Functions FastForward: System variables Up: Control structures Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4.3.1, 2022, generated by texi2html.