-
-
Save danielctull/f20fe5e1aaeaf6c08cd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum MyEnum { | |
case StateA | |
case StateB | |
} | |
let enumValueA = MyEnum.StateA | |
let enumValueB = MyEnum.StateB | |
if enumValueA == enumValueB { | |
println("Same") | |
} | |
else { | |
println("Different") | |
} | |
enum AnotherEnum { | |
case StateA | |
case StateB(Int) | |
} | |
let anotherEnumValueA = AnotherEnum.StateA | |
let anotherEnumValueB = AnotherEnum.StateB(1) | |
if anotherEnumValueA == anotherEnumValueB { // Compiler error | |
println("Same") | |
} | |
else { | |
println("Different") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment