File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,15 @@ object Options extends FlatSpec with Matchers with exercise.Section {
2222 emptyValue should be(res1)
2323 }
2424
25- /** Using `getOrElse` we can provide a default value ("No value") when the optional argument (`None`) does not exist:
25+ /** Let's write a function that may or not give us a string, thus returning `Option[String]`:
26+ *
27+ * {{{
28+ * def maybeItWillReturnSomething(flag: Boolean): Option[String] = {
29+ * if (flag) Some("Found value") else None
30+ * }
31+ * }}}
32+ *
33+ * Using `getOrElse` we can provide a default value ("No value") when the optional argument (`None`) does not exist.
2634 */
2735 def getOrElseOptions (res0 : String , res1 : String , res2 : String ) {
2836 val value1 = maybeItWillReturnSomething(true )
You can’t perform that action at this time.
0 commit comments