You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
489 B
13 lines
489 B
1 year ago
|
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"),
|
||
|
}
|
||
|
}
|