Skip to content

Instantly share code, notes, and snippets.

@dacr
Created July 13, 2014 17:16
Show Gist options
  • Save dacr/b68c0300c574cb672456 to your computer and use it in GitHub Desktop.
Save dacr/b68c0300c574cb672456 to your computer and use it in GitHub Desktop.
scala> if (from1.isDefined) from1 else
| if (from2.isDefined) from2 else
| if (from3.isDefined) from3 else
| Some("Default Value")
res5: Option[String] = Some(found)
scala> from1 match {
| case x if x.isDefined => x
| case _ =>
| from2 match {
| case x if x.isDefined => x
| case _ =>
| from3 match {
| case x if x.isDefined => x
| case _ => Some("Default Value")
| }
| }
| }
res6: Option[String] = Some(found)
scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment