The While Statement

The general form of the while statement is
while(test condition)
{
body of the loop
}
The while construct start with the while keyword followed by the test condition in the parenthesis. The body of the loop is included in the pair of braces. When the while keyword is encountered the test condition is checked.If it evaluates to true, the body of the loop is executed. Then the control again goes back to while. The condition is checked and again the body of the loop executed if true. Thus, the process repeates until the condition in the while loop evaluates to true. When the finally becomes false, the body of the loop is skipped and control is transferred to the statement which immediately follows the body of the loop.

No comments:

Post a Comment