Skip to content

Commit e157487

Browse files
authored
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).
1 parent 697054c commit e157487

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pattern-matching/match.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Key Points:
4343
wish to concisely express more complex ideas than patterns alone would allow.
4444
- They are not the same as separate `if` expression inside of the match arm. An
4545
`if` expression inside of the branch block (after `=>`) happens after the
46-
match arm is selected. Failing the `if` condition inside of that block won't
46+
match arm is selected. Failing the `if` condition inside of that block will
4747
result in other arms of the original `match` expression being considered.
4848
- The condition defined in the guard applies to every expression in a pattern
4949
with an `|`.

0 commit comments

Comments
 (0)