From d47f06345b37cecf4072523c1c79f63f37846d8c Mon Sep 17 00:00:00 2001
From: Pavel Kazlou
Date: Sat, 31 Oct 2015 16:50:40 +0300
Subject: added docs for default case in pattern matching
---
scala.html.markdown | 3 +++
1 file changed, 3 insertions(+)
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
--
cgit v1.2.3