From e157487e6ebb3cd48a0924d0cd1650e337e0fd04 Mon Sep 17 00:00:00 2001 From: Vinh Tran Date: Sun, 27 Jul 2025 12:52:11 -0400 Subject: [PATCH] Fix typo in Matching Values section (#2832) Given ``` #[rustfmt::skip] fn main() { let input = '1'; match input { key if key.is_lowercase() => println!("Lowercase: {key}"), 'q' => println!("Quitting"), 'a' | 's' | 'w' | 'd' => println!("Moving around"), '0'..='9' => println!("Number input"), _ => println!("Something else"), } } ``` the output will be ``` Number input ``` So in practice, failing the condition does result to the other arms if the other arms are after that (if I'm reading this correctly). --- src/pattern-matching/match.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pattern-matching/match.md b/src/pattern-matching/match.md index 916950e9..c607b84c 100644 --- a/src/pattern-matching/match.md +++ b/src/pattern-matching/match.md @@ -43,7 +43,7 @@ Key Points: wish to concisely express more complex ideas than patterns alone would allow. - They are not the same as separate `if` expression inside of the match arm. An `if` expression inside of the branch block (after `=>`) happens after the - match arm is selected. Failing the `if` condition inside of that block won't + match arm is selected. Failing the `if` condition inside of that block will result in other arms of the original `match` expression being considered. - The condition defined in the guard applies to every expression in a pattern with an `|`.