Question 19
Back to Exercise
When is a switch usually clearer than an if-else ladder?
- A When comparing ranges like marks > 90
- B When comparing one value against many constants (codes, enum constants, strings) Correct
- C Never
- D Only for booleans
Correct Answer: Option B
Range checks still need if (or guards in a pattern switch).
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!