Home Segments Index Top Previous Next

189: Mainline

C's iteration statements enable functions to do computations over and over until a test has been satisfied. C's while statement, for example, consists of a Boolean expression, in parentheses, followed by an embedded statement:

while (Boolean expression) 
  embedded statement 

The Boolean expression is evaluated, and if the Boolean expression evaluates to any integer other than 0, the embedded statement is evaluated as well; otherwise, C skips the embedded statement. In contrast to an if statement, however, the evaluate-Boolean-expression–evaluate-embedded-statement cycle continues as long as the Boolean expression evaluates to some integer other than 0.