From ffb077f3d9126451bfef7f259d46498f35f41995 Mon Sep 17 00:00:00 2001 From: Alex Kuznetsov Date: Mon, 4 Jul 2022 12:00:33 -0500 Subject: [PATCH] add-examples-to-destructure-tuples --- src/flow_control/match/destructuring/destructure_tuple.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/flow_control/match/destructuring/destructure_tuple.md b/src/flow_control/match/destructuring/destructure_tuple.md index 03f81427bd..32a77da08a 100644 --- a/src/flow_control/match/destructuring/destructure_tuple.md +++ b/src/flow_control/match/destructuring/destructure_tuple.md @@ -13,6 +13,8 @@ fn main() { // Destructure the second and third elements (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"), // `..` can be used to ignore the rest of the tuple _ => println!("It doesn't matter what they are"), // `_` means don't bind the value to a variable