From 4fb790dd7b1551bd1d30eec418b70f7b2e02d6a7 Mon Sep 17 00:00:00 2001 From: Tejas S Gowda Date: Wed, 8 Oct 2025 08:25:26 +0530 Subject: [PATCH] Add an example showing pattern binding when matching several values in a match arm --- src/flow_control/match/binding.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/flow_control/match/binding.md b/src/flow_control/match/binding.md index 2b17bd1b46..ecfbc80e70 100644 --- a/src/flow_control/match/binding.md +++ b/src/flow_control/match/binding.md @@ -25,6 +25,8 @@ fn main() { // Now the age can be reported. n @ 1 ..= 12 => println!("I'm a child of age {:?}", n), n @ 13 ..= 19 => println!("I'm a teen of age {:?}", n), + // A similar binding can be done when matching several values. + n @ (1 | 7 | 15 | 13) => println!("I'm a teen of age {:?}", n), // Nothing bound. Return the result. n => println!("I'm an old person of age {:?}", n), }