Controlling Program Flow with Decision-Making Statements
In This Chapter
Writing statements that choose between alternatives
Putting statements inside one another
Choosing among many alternatives
The TV show Dennis the Menace aired on CBS from 1959 to 1963. I remember one episode in which Mr. Wilson was having trouble making an important decision. I think it was something about changing jobs or moving to a new town. Anyway, I can still see that shot of Mr. Wilson sitting in his yard, sipping lemonade, and staring into nowhere for the whole afternoon. Of course, the annoying character Dennis was constantly interrupting Mr. Wilson’s peace and quiet. That’s what made this situation funny.
What impressed me about this episode (the reason why I remember it so clearly even now) was Mr. Wilson’s dogged intent in making the decision. This guy wasn’t going about his everyday business, roaming around the neighborhood, while thoughts about the decision wandered in and out of his mind. He was sitting quietly in his yard, making marks carefully and logically on his mental balance sheet. How many people actually make decisions this way?
At that time, I was still pretty young. I’d never ...