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]