Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created Apr 2, 2015
Embed
What would you like to do?
object Color extends Enumeration {
val Blue, Red, Magenta, Green, Cyan, Yellow, White = Value
}
object Main {
import Color._
def mix(a:Color.Value, b:Color.Value): Color.Value = {
Color(a.id + b.id)
}
def main(args: Array[String]): Unit = {
// mix
println(mix(Blue, Blue))
// mix
println(mix(Blue, Red))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment