Skip to content

Instantly share code, notes, and snippets.

@drguildo
Created June 6, 2020 15:46
Show Gist options
  • Save drguildo/9665720eea127ce8db2646d47d65f1ba to your computer and use it in GitHub Desktop.
Save drguildo/9665720eea127ce8db2646d47d65f1ba to your computer and use it in GitHub Desktop.
fn foo1() {
let foo: Option<i32> = Some(1234);
println!("{}", foo.unwrap_or(4321));
let bar = foo;
}
fn foo2() {
let foo: Option<String> = Some("1234".to_string());
println!("{}", foo.unwrap_or("4321".to_string()));
let bar = foo;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment