+ 3
Using of switch/case
For example, if all the statements in the code are true and all of them are possible and match, how do I choose which case will be printed at first place? Or will all of them be printed?
2 Answers
+ 2
The default case will be printed, unless you choose not to use the "break" keyword. I would say that If statements are more suitable for this kind of conditional; since switch is more used to checking values.
0
The order the cases are provided is the order they'll be evaluated. If the first case is true, the evaluation will conclude without assessing the other cases and return.