CMPS 162: Introduction to Programming
Switch statements are similar to an if statement with many else if branches, but with a nicer syntax as well. One caveat is that once a case matches, the code for all subsequent cases will also be executed unless one specifically breaks out of the switch statement. While loops are an alternative to for loops that are sometimes a better fit (e.g., when testing for a boolean) and come in two different forms.
- Show how to start switch statements
- Show how to complete switch statements
- Illustrate while loops
- Illustrate do…while loops
- Module 7 Readings: Chapters 39 thru 42 from Myers
- Module 7 Assignment: Interactive Coding Exercises 39 thru 42