February 2014
Beginner
1248 pages
62h 25m
English
Without break statements, each time a match occurs in the switch, the statements for that case and subsequent cases execute until a break statement or the end of the switch is encountered. This is often referred to as “falling through” to the statements in subsequent cases. (This feature is perfect for writing a concise program that displays the iterative song “The Twelve Days of Christmas” in Exercise 5.29.)
Common Programming Error 5.7
Forgetting a break statement when one is needed in a switch is a logic error.
Read now
Unlock full access