iOS ● ● ○ Swift 6

Kodebits Day 78: Switch Where Clause

Aug 18 2026
Practice switch statements with a short swift challenge.

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]


Further Reading