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

12 lines
226 B
Rust
Raw Normal View History

2023-09-29 20:52:18 +00:00
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),
_ => (),
}
}