What is the output of this problem?
let x = 5, y = 10
switch (x, y) {
case (_, _):
println("_, _")
case (5, _):
println("5, _")
case (_, 10):
println("_, 10")
case (5, 10):
println("5, 10")
}
If you said, ", ", then great! If you're sad that case (5, 10):
doesn't match… well, you're not alone.
Friendly reminder, always read your swift-statements like a chain of if-statements. With pattern matching in Swift, this could be the source of some inadvertent bugs, especially when adding new case
clauses.
UPDATE: I filed rdar://21001503 about having a warning for case statements that can not be reached.