Skip to content

Commit 99ec85e

Browse files
committed
withName example
1 parent da45f83 commit 99ec85e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ object Greeting extends Enum[Greeting] {
4242

4343
}
4444

45+
// Object Greeting has a `withName(name: String)` method
46+
Greeting.withName("Hello")
47+
48+
// => res0: Greeting = Hello
49+
50+
Greeting.withName("Haro")
51+
// => java.lang.IllegalArgumentException: Haro is not a member of Enum Greeting$@7d6b560b
52+
4553
import Greeting._
4654

4755
def tryMatching(v: Greeting): Unit = v match {

0 commit comments

Comments
 (0)