summaryrefslogtreecommitdiffhomepage
path: root/scala.html.markdown
diff options
context:
space:
mode:
authorGeoff Liu <cangming.liu@gmail.com>2015-12-18 16:27:53 -0500
committerGeoff Liu <cangming.liu@gmail.com>2015-12-18 16:27:53 -0500
commit97b21a786513ce168ec6b8bb2a73557b6fa00894 (patch)
tree89e7524c5673ca78f7c0cce35bbf5ad2fbda9679 /scala.html.markdown
parent68bfe95ba599f1c7254de1460d7f4817c6b032ec (diff)
parentd47f06345b37cecf4072523c1c79f63f37846d8c (diff)
Merge pull request #1955 from pikazlou/scala-pattern-matching
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 bc8cd422..56f31f33 100644
--- a/scala.html.markdown
+++ b/scala.html.markdown
@@ -460,6 +460,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