iOS ● ○ ○ Swift 6

Kodebits Day 81: Guard Multiple Bindings

Aug 25 2026
Practice guard with a short swift challenge.

What does this print?

func check(_ a: Int?, _ b: Int?) {
  guard let a, let b else {
    print("Missing")
    return
  }
  print(a + b)
}
check(3, 7)
check(nil, 5)


Try it in the online Swift Playground →

[spoiler title="Solution"]

Answer:

10
Missing

Explanation:

guard unwraps multiple optionals, exiting early if any are nil.

[/spoiler]


Further Reading