Skip to content

Instantly share code, notes, and snippets.

@ponzao
Created September 8, 2010 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ponzao/569867 to your computer and use it in GitHub Desktop.
Save ponzao/569867 to your computer and use it in GitHub Desktop.
val n: Option[Int] = None
val res = n.map(_ + 4).map(_ + 100)
res.getOrElse(0) // => 0
val n: Option[Int] = Some(10)
val res = n.map(_ + 4).map(_ + 100)
res.getOrElse(0) // => 114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment