Skip to content

Commit

Permalink
withName example
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydmeta committed Dec 7, 2014
1 parent da45f83 commit 99ec85e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ object Greeting extends Enum[Greeting] {

}

// Object Greeting has a `withName(name: String)` method
Greeting.withName("Hello")

// => res0: Greeting = Hello

Greeting.withName("Haro")
// => java.lang.IllegalArgumentException: Haro is not a member of Enum Greeting$@7d6b560b

import Greeting._

def tryMatching(v: Greeting): Unit = v match {
Expand Down

0 comments on commit 99ec85e

Please sign in to comment.