Skip to content

Instantly share code, notes, and snippets.

@jesusjavierdediego
Created February 11, 2019 14:07
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 jesusjavierdediego/612aad91cecdb51472a89033d139f089 to your computer and use it in GitHub Desktop.
Save jesusjavierdediego/612aad91cecdb51472a89033d139f089 to your computer and use it in GitHub Desktop.
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