Skip to content

Commit

Permalink
Merge pull request #6 from myeonginwoo/fold
Browse files Browse the repository at this point in the history
fixed README about fold
  • Loading branch information
myeonginwoo authored Dec 28, 2016
2 parents d616024 + 77c0b34 commit 8005da4
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 8005da4

Please sign in to comment.