tuples

Tuples can be destructured in a match as follows:

1. fn main() {
2. let pair = (0, -2);
3. // TODO ^ Try different values for `pair`

5. println!("Tell me about {:?}", pair);
6. // Match can be used to destructure a tuple
7. match pair {
8. // Destructure the second
9. (0, y) => println!("First is `0` and `y` is `{:?}`", y),
10. (x, 0) => println!("`x` is `{:?}` and last is `0`", x),
11. _      => println!("It doesn't matter what they are"),
12. // `_` means don't bind the value to a variable
13. }
14. }

See also:

Tuples