Skip to content

Commit

Permalink
fixed README about fold
Browse files Browse the repository at this point in the history
  • Loading branch information
myeonginwoo committed Dec 28, 2016
1 parent 6a85aaa commit 77c0b34
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ val either: Either<String, Int> = try {
}
```

fold
```kotlin
val leftEither: Either<String, Int> = Left("test")
println(leftEither.fold({ "Left is $it" }, { it * 3 })) // "Left is test"

val rightEither: Either<String, Int> = Right(6)
pirntln(rightEither.fold({ "Left is $it" }, { it * 3 })) // 18)
```

map
```kotlin
//left
Expand Down

0 comments on commit 77c0b34

Please sign in to comment.