Created
April 2, 2015 23:39
-
-
Save shigemk2/406940a81d1b146c0846 to your computer and use it in GitHub Desktop.
This file contains 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
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