Much more flow control destructuring in RBE
This commit is contained in:
19
rustbyexample/flow_control.d/match.rs
Normal file
19
rustbyexample/flow_control.d/match.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
fn main() {
|
||||
let number = 13;
|
||||
|
||||
println!("Tell me about {}", number);
|
||||
match number {
|
||||
1 => println!("One!"),
|
||||
2 | 3 | 5 | 7 | 11 => println!("This is a prime"),
|
||||
13..=19 => println!("A teen"),
|
||||
_ => println!("Ain't special"),
|
||||
}
|
||||
|
||||
let boolean = true;
|
||||
let binary = match boolean {
|
||||
false => 0,
|
||||
true => 1,
|
||||
};
|
||||
|
||||
println!("{} -> {}", boolean, binary);
|
||||
}
|
Reference in New Issue
Block a user