Option unwrapor
📝 RustTakes an Option and returns its inner value if Some, otherwise returns a provided default value.
Rust
fn main() { let someval = Some(5); let noneval: Option<i32> = None; let a = someval.unwrapor(0); let b = noneval.unwrapor(10); println!("{} {}", a, b);
}
Comments
No comments yet. Start the discussion.