4.8 while Repetition Statement
A repetition statement allows you to specify that a program should repeat an action while some condition remains true. The pseudocode statement
While there are more items on my shopping list Purchase next item and cross it off my list
describes the repetition during a shopping trip. The condition “there are more items on my shopping list” may be true or false. If it’s true, then the action “Purchase next item and cross it off my list” is performed. This action will be performed repeatedly while the condition remains true. The statement(s) contained in the While repetition statement constitute its body, which may be a single statement or a block. Eventually, the condition will become false (when the shopping ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access