Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created February 2, 2015 13:51
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/6e5ec04c5df9def70f0d to your computer and use it in GitHub Desktop.
Save shigemk2/6e5ec04c5df9def70f0d to your computer and use it in GitHub Desktop.
val i = 5
i match {
case 1 | 3 | 5 | 7 | 9 => println("odd")
case 2 | 4 | 6 | 8 | 10 => println("even")
}
val cmd = "stop"
cmd match {
case "start" | "go" => println("starting")
case "stop" | "quit" | "exit" => println("stopping")
case _ => println("doing nothing")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment