scala> object Day extends Enumeration { type Day = Value; val monday = Value("Monday"); val tuesday = Value("Tuesday") }
defined module Day
scala> import Day._
import Day._
scala> val d = monday
d: Day.Value = Monday
scala> d match { case tuesday => "Oops"; case monday => "Here I am" }
<console>:13: warning: unreachable code
d match { case tuesday => "Oops"; case monday => "Here I am" }
^
res0: String = Oops
It's more useful at any rate. An identifier starting with an uppercase can be used in pattern matching.