getOrElse method
T
getOrElse(
- T orElse()
If this Option is a Some then return the value inside the Option.
Otherwise return the result of orElse
.
[🍌].getOrElse(() => 🍎) -> 🍌
[_].getOrElse(() => 🍎) -> 🍎
👆 same as 👇
[🍌].match(() => 🍎, (🍌) => 🍌)
Implementation
T getOrElse(T Function() orElse) => match(orElse, identity);