5.12 Wrap-Up
In this chapter, we completed our introduction to control statements, which enable you to control the flow of execution in methods. Chapter 4 discussed if, if…else and while. This chapter demonstrated for, do…while and switch. We showed that any algorithm can be developed using combinations of the sequence structure, the three types of selection statements—if, if…else and switch—and the three types of iteration statements—while, do…while and for. In this chapter and Chapter 4, we discussed how you can combine these building blocks to utilize proven program-construction and problem-solving techniques. You used the break statement to exit a switch statement and to immediately terminate a loop, and used a continue statement to terminate ...
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