Skip to content

Commit 97a8973

Browse files
authored
add-examples-to-destructure-tuples (#1566)
1 parent 83724ca commit 97a8973

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/flow_control/match/destructuring/destructure_tuple.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ fn main() {
1313
// Destructure the second and third elements
1414
(0, y, z) => println!("First is `0`, `y` is {:?}, and `z` is {:?}", y, z),
1515
(1, ..) => println!("First is `1` and the rest doesn't matter"),
16+
(.., 2) => println!("last is `2` and the rest doesn't matter"),
17+
(3, .., 4) => println!("First is `3`, last is `4`, and the rest doesn't matter"),
1618
// `..` can be used to ignore the rest of the tuple
1719
_ => println!("It doesn't matter what they are"),
1820
// `_` means don't bind the value to a variable

0 commit comments

Comments
 (0)