Created
February 6, 2016 19:52
-
-
Save yarneo/bb872ae9cae01c4b4996 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 Person { | |
case FullName(String) | |
case personID(Int) | |
init(personID: Int) { | |
if personID == 123456789 { | |
self = .FullName(“Barack Obama”) | |
} else { | |
self = .personID(personID) | |
} | |
} | |
} | |
let president: Person = Person(personID: 123456789) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment