“Would you tell me, please, which way I ought to go from here?” “That depends a good deal on where you want to get to.”
|--Lewis Carroll, Alice in Wonderland|
A program consisting only of a list of consecutive statements is immediately useful because the statements are executed in the order in which they're written. But the ability to control the order in which statements are executed—that is, to test conditions and execute different statements based on the results of the tests—adds enormous value to our programming toolkit. This chapter covers almost all the control flow statements that direct the order of execution. Exceptions and assertions are covered separately in Chapter 12.
The two basic statements ...