Top
Back: 5.2.10 return
Forward: 5.2.12 ~ (break point)
FastBack: 5. Functions and system variables
FastForward: 6. Tricks and pitfalls
Up: 5.2 Control structures
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

5.2.11 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: 5.2.10 return Forward: 5.2.12 ~ (break point) FastBack: 5. Functions and system variables FastForward: 6. Tricks and pitfalls Up: 5.2 Control structures Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.