We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f76a77b + f9b0d10 commit f2a56f3Copy full SHA for f2a56f3
src/main/scala/stdlib/Options.scala
@@ -22,7 +22,15 @@ object Options extends FlatSpec with Matchers with exercise.Section {
22
emptyValue should be(res1)
23
}
24
25
- /** Using `getOrElse` we can provide a default value ("No value") when the optional argument (`None`) does not exist:
+ /** 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.
34
*/
35
def getOrElseOptions(res0: String, res1: String, res2: String) {
36
val value1 = maybeItWillReturnSomething(true)
0 commit comments