conditionals-3 Flashcards
1
Q
What is the primary use case for switches?
A
to select one of many code blocks to be executed
2
Q
Does the default case have to be at the bottom of the switch statement?
A
A “default” section is optional. A “default” may appear anywhere in the switch but is usually placed at the bottom.
3
Q
What happens if there is no break statement between cases?
A
If we do not use break statement at the end of each case, program will execute all consecutive case statements until it finds next break statement or till the end of switch case block.