I\'m searching for the syntax to do pattern matching with multiple cases in an if case statement. The example would be this:
enum Gender {
case Male, Fem
For pattern matching, what you describe will not work yet. You could do this in your case. But if it cannot be convert into a hashValue
. Then this would not work either.
// Using Pattern Matching for more than one case.
if case 0...2 = a.hashValue {
print("Hello")
}
//Normal if else
if a == .Male || a == .Female {
print("Hello")
}