while Repetition Statement

The while repetition statement allows the programmer to specify that a program should repeat an action while some condition remains true. The pseudocode for the while repetiion statement is

while (expression)
   statement

The statement in the body of the loop will be performed repeatedly while the condition remains true. The statement contained in the loop constitute the body of the loop , which may be a single statement or a block. When the condition become false, the repetition terminates and the first statement affter the loop executes. The expression in the while statement must evaluate to a boolean value of true or false.

The while statement is typically used for sentinel-controlled repetition.

Fook Yuen Sin - Team 1