We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c5f969a commit 4de0733Copy full SHA for 4de0733
_tour/extractor-objects.md
@@ -45,12 +45,18 @@ val CustomerID(name) = customer2ID
45
println(name) // prints Nico
46
```
47
48
-This is equivalent to `val name = CustomerID.unapply(customer2ID).get`. If there is no match, a `scala.MatchError` is thrown:
+This is equivalent to `val name = CustomerID.unapply(customer2ID).get`.
49
50
-```tut:fail
+```tut
51
val CustomerID(name2) = "--asdfasdfasdf"
52
53
54
+If there is no match, a `scala.MatchError` is thrown:
55
+
56
+```tut:fail
57
+val CustomerID(name3) = "-asdfasdfasdf"
58
+```
59
60
The return type of an `unapply` should be chosen as follows:
61
62
* If it is just a test, return a `Boolean`. For instance `case even()`.
0 commit comments