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 {
22
22
emptyValue should be(res1)
23
23
}
24
24
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.
26
34
*/
27
35
def getOrElseOptions (res0 : String , res1 : String , res2 : String ) {
28
36
val value1 = maybeItWillReturnSomething(true )
You can’t perform that action at this time.
0 commit comments