Skip to content

Instantly share code, notes, and snippets.

@manjuraj
Last active January 4, 2016 01:39
Show Gist options
  • Save manjuraj/8549678 to your computer and use it in GitHub Desktop.
Save manjuraj/8549678 to your computer and use it in GitHub Desktop.
Enumerations
// 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