Created
July 13, 2014 17:16
-
-
Save dacr/b68c0300c574cb672456 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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