summaryrefslogtreecommitdiffhomepage
path: root/scala.html.markdown
diff options
context:
space:
mode:
authorPavel Kazlou <p.i.kazlou@gmail.com>2015-10-31 16:50:40 +0300
committerPavel Kazlou <p.i.kazlou@gmail.com>2015-10-31 16:50:40 +0300
commitd47f06345b37cecf4072523c1c79f63f37846d8c (patch)
tree2392c9775184b57a0db7babf2d0f6b600589c206 /scala.html.markdown
parente56bc6cbca1058f61f2fb7247888eb52068cb63d (diff)
added docs for default case in pattern matching
Diffstat (limited to 'scala.html.markdown')
-rw-r--r--scala.html.markdown3
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