Skip to content

Commit

Permalink
Merge pull request #87 from KevinGreene/patch-2
Browse files Browse the repository at this point in the history
Update Options.scala to improve clarity with option folding
  • Loading branch information
juanpedromoreno committed May 19, 2017
2 parents 13aa90a + 537b787 commit 2bde75a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/stdlib/Options.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ object Options extends FlatSpec with Matchers with org.scalaexercises.definition
def foldOptions(res0: Int, res1: Int) {
val number: Option[Int] = Some(3)
val noNumber: Option[Int] = None
val result1 = number.fold(0)(_ * 3)
val result2 = noNumber.fold(0)(_ * 3)
val result1 = number.fold(1)(_ * 3)
val result2 = noNumber.fold(1)(_ * 3)

result1 should be(res0)
result2 should be(res1)
Expand Down

0 comments on commit 2bde75a

Please sign in to comment.