iOS ● ○ ○ Swift 6

Kodebits Day 100: Enum Cases

Sep 30 2026
Practice enums with a short swift challenge.

What is the output?

enum Direction {
  case north, south, east, west
}
let d = Direction.north
if d == .north {
  print("Go up")
} else {
  print("Other way")
}

[spoiler title="Solution"]

Answer:

Go up

Explanation:

Enums define groups of related values; dot syntax matches cases.

[/spoiler]


Further Reading