box-o-sand/rustbyexample/flow_control.d/match.d/binding2.rs

12 lines
226 B
Rust

fn some_number() -> Option<u32> {
Some(42)
}
fn main() {
match some_number() {
Some(n @ 42) => println!("The Answer: {}!", n),
Some(n) => println!("Not interesting... {}", n),
_ => (),
}
}