diff options
Diffstat (limited to 'scala.html.markdown')
-rw-r--r-- | scala.html.markdown | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/scala.html.markdown b/scala.html.markdown index 192e03d7..131bd71c 100644 --- a/scala.html.markdown +++ b/scala.html.markdown @@ -454,6 +454,9 @@ def matchEverything(obj: Any): String = obj match { // You can nest patterns: case List(List((1, 2, "YAY"))) => "Got a list of list of tuple" + + // Match any case (default) if all previous haven't matched + case _ => "Got unknown object" } // In fact, you can pattern match any object with an "unapply" method. This |