Last active
January 4, 2016 01:39
-
-
Save manjuraj/8549678 to your computer and use it in GitHub Desktop.
Enumerations
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
// Enumeration | |
object Color extends Enumeration { | |
type Color = Value | |
val Red = Value("red") | |
val Blue = Value("blue") | |
val Green = Value("green") | |
} | |
import Color._ | |
Color.Red // Color.Value = red | |
Color.withName("red") // Color.Value = red | |
Color(0) // Color.Value = Red |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment