Created
February 11, 2019 14:07
-
-
Save jesusjavierdediego/612aad91cecdb51472a89033d139f089 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 Maps { | |
val colors = Map("red" -> 0xFF0000, | |
"turquoise" -> 0x00FFFF, | |
"black" -> 0x000000, | |
"orange" -> 0xFF8040, | |
"brown" -> 0x804000) | |
def main(args: Array[String]) { | |
for (name <- args) println( | |
colors.get(name) match { | |
case Some(code) => | |
name + " has code: " + code | |
case None => | |
"Unknown color: " + name | |
} | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment