
Prelab Activities
Review
In Chapter 5, we looked at Boolean expressions and considered how they can be used
in the if statement to make a choice. In this chapter, we examine how Boolean
expressions can be used in a while statement to make the program repeat a statement
or a group of statements. Such repetitions are called loops.
while Statement
The if statement allows the program to skip the execution of a statement or choose
between one of two statements to be executed based on the value of a Boolean
expression. In contrast, the while statement allows a program to continue executing a
statement as long as the value of a Boolean expression is true. When ...