James P. Cohoon,
University of Virginia Jack W. Davidson,
University of Virginia
Control constructs
Chapter Objectives
Upon completion of this chapter the student will understand and be able to utilize the following key concepts:
We consider two conditional constructs—the if and switch—that control whether a statement list is executed.
We also consider three iterative constructs—the while, for, and do—that control how many times a statement list is executed.
Except for the switch construct, which performs a matching process to determine which statements are executed, these control constructs use logical expressions to determine their course of action.
Our examination of control constructs begins with a discussion of logical expressions.