Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created April 2, 2015 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/406940a81d1b146c0846 to your computer and use it in GitHub Desktop.
Save shigemk2/406940a81d1b146c0846 to your computer and use it in GitHub Desktop.
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