Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Created January 7, 2012 22:10
Show Gist options
  • Select an option

  • Save diegopacheco/1576223 to your computer and use it in GitHub Desktop.

Select an option

Save diegopacheco/1576223 to your computer and use it in GitHub Desktop.
Scala Pattern Matcher with High Order Functions
def whatTodo(on:String):Unit = on match {
case "Monday" => println("Hard Work")
case "Friday" => println("Lazy Work")
case "Saturday" => println("Fun")
case "Sunday" => println("REST")
case _ => println("Code Scala")
}
val days = List("Monday","Wendsday","Friday","Sunday","Saturday")
days foreach whatTodo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment