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

10 lines
209 B
Rust

fn main() {
let number: u8 = 4;
match number {
i if i == 0 => println!("Zero"),
i if i > 0 => println!("Greater than zero"),
_ => unreachable!("Should never happen."),
}
}