I'm trying to implement a switch between two option values:
import UIKit
var numOne: Int?
var numTwo: Int?
func doSomething() {
switch (numOne, numTwo) {
case (!nil, nil):
print("something")
case (_ == _):
print("equal")
default:
break
}
}
doSomething()
But I'm getting this errors:
In the first case I'm getting this error:
'nil' is not compatible with expected argument type 'Bool'
in the second case I'm getting this other error:
Expression pattern of type 'Bool' cannot match values of type '(Int?, Int?)'
My question for you guys is how can I manage to generate the cases between this to optional values?
I'll really appreciate your help