September 1998
Intermediate to advanced
848 pages
20h 13m
English
The keyword for the while statement is while.
The while statement creates a loop that repeats until the test expression becomes false, or zero. The while statement is an entry-condition loop; the decision to go through one more pass of the loop is made before the loop has been traversed. Therefore, it is possible that the loop is never traversed. The statement part of the form can be a simple statement or a compound statement.
while (expression) statement
The statement portion is repeated until the expression becomes false or zero.
while (n++ < 100)
printf(" %d %d\n",n, 2*n+1);
while (fargo < 1000)
{
fargo = fargo + step;
step = 2 * step;
}
Read now
Unlock full access