What is the output?
let value = 15
switch value {
case let x where x < 10:
print("Low")
case let x where x < 20:
print("Mid")
default:
print("High")
}
Try it in the online Swift Playground →
[spoiler title="Solution"]
Answer:
Mid
Explanation:
where clauses add conditions to switch cases for finer control.
[/spoiler]