mastery 19


mastery 19

mastery 19

Use of loops with “while”
Syntax:
The syntax of a while loop in C++ is:

while(condition)
{
statement(s);
}
Here, statement(s) may be a single statement or a block of statements.
The condition may be any expression, and true is any non-zero value. The loop iterates while the condition is true.

When the condition becomes false, program control passes to the line immediately following the loop.

Here, key point of the while loop is that the loop might not ever run. When the condition is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed.

link: http://www.tutorialspoint.com/cplusplus/cpp_while_loop.htm

CC BY 4.0 mastery 19 by ivanna lases is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.