Last active
January 15, 2018 07:28
-
-
Save agoiabel/330cff2bc1285a95ce8de860a120ce44 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// You can also map to strings | |
enum Week: String { | |
case Sunday = "Weekday" | |
case Monday = "Weekday" | |
case Tuesday = "Weekday" | |
case Wednessday = "Weekday" | |
case Thursday = "Weekday" | |
case Friday = "Weekend" | |
case Saturday = "Weekend" | |
} | |
// You can also map to Int | |
enum Movement: Int { | |
case Left = 0 | |
case Right = 1 | |
case Top = 2 | |
case Bottom = 3 | |
} | |
// Or to floating point | |
enum Constants: Double { | |
case π = 3.14159 | |
case e = 2.71828 | |
case φ = 1.61803398874 | |
case λ = 1.30357 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment