Skip to content

Instantly share code, notes, and snippets.

@notyy
Created September 22, 2011 14:35
Show Gist options
  • Save notyy/1234930 to your computer and use it in GitHub Desktop.
Save notyy/1234930 to your computer and use it in GitHub Desktop.
can match any parameter
def tryMatch: PartialFunction[Any, Unit] = {
case s:String => println("its a string:" + s)
case (s1:String,s2:String) => println("two strings:" + s1 + " and "+ s2)
case i:Int => println("its a int:" + i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment