val number: Option[Int] = Some(3) val noNumber: Option[Int] = None val result1 = number.fold(1)(_ * 3) val result2 = noNumber.fold(1)(_ * 3) println(result1) println(result2)
Login in to like
Login in to comment
or Read more about Scala Quizzes
Login in to like
Login in to comment