Much more flow control destructuring in RBE

This commit is contained in:
2023-09-27 23:16:10 -04:00
parent 460741740b
commit ca812add16
8 changed files with 161 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
fn main() {
let triple = (0, -2, 3);
println!("Tell me about {:?}", triple);
match triple {
(0, y, z) => println!("First is `0`, `y` is {:?}, and `z` is {:?}", y, z),
(1, ..) => println!("First is `1` and the rest doesn't matter"),
(.., 2) => println!("last is `2` and the rest doesn't matter"),
(3, .., 4) => println!("First is `3`, last is `4`, and the rest doesn't matter"),
_ => println!("It doesn't matter what they are"),
}
}