Is there a concise way to obtain the “inner value” of an option without using switch
? For example:
let str = Some("hi there!")
let unwrapStr = switch str { // a shorcut would be nice
| Some(value) => value
| None => ""
}
In other languages, like Rust, we can use the unwrap_or
function ( let unwrapStr = str.unwrap_or("")
).