public
Last active

  • Download Gist
Test.scala
Scala
1 2 3 4 5 6 7 8 9 10 11 12 13 14
scala> els
res4: Int = 222
 
scala> opt
res5: Some[Int] = Some(1)
 
scala> opt.foldLeft(els)((_,elem) => identity(elem))
res9: Int = 1
 
scala> val optNone: Option[Int] = None
optNone: Option[Int] = None
 
scala> optNone.foldLeft(els)((_,elem) => identity(elem))
res10: Int = 222

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.