Skip to content

Commit 2bde75a

Browse files
Merge pull request #87 from KevinGreene/patch-2
Update Options.scala to improve clarity with option folding
2 parents 13aa90a + 537b787 commit 2bde75a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/scala/stdlib/Options.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ object Options extends FlatSpec with Matchers with org.scalaexercises.definition
9898
def foldOptions(res0: Int, res1: Int) {
9999
val number: Option[Int] = Some(3)
100100
val noNumber: Option[Int] = None
101-
val result1 = number.fold(0)(_ * 3)
102-
val result2 = noNumber.fold(0)(_ * 3)
101+
val result1 = number.fold(1)(_ * 3)
102+
val result2 = noNumber.fold(1)(_ * 3)
103103

104104
result1 should be(res0)
105105
result2 should be(res1)

0 commit comments

Comments
 (0)