added docs for default case in pattern matching

This commit is contained in:
Pavel Kazlou 2015-10-31 16:50:40 +03:00
parent e56bc6cbca
commit d47f06345b

View File

@ -454,6 +454,9 @@ def matchEverything(obj: Any): String = obj match {
// You can nest patterns: // You can nest patterns:
case List(List((1, 2, "YAY"))) => "Got a list of list of tuple" 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 // In fact, you can pattern match any object with an "unapply" method. This