Created
April 1, 2013 18:15
-
-
Save esuomi/5286625 to your computer and use it in GitHub Desktop.
Quick pattern match test with Strings.
This file contains hidden or 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 worksheet { | |
def call[T](t:T, s:String) : (T,String) = { (t, s) } | |
//> call: [T](t: T, s: String)(T, String) | |
call("foo", "bar") match { | |
case (x, "bar") => println("found bar") | |
case (x, "baz") => println("found baz") | |
} //> found bar | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment