You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-15 13:50:27 +02:00
Updates and minor fixes to Day 2: Morning (#372)
This commit is contained in:
@ -10,7 +10,7 @@ expression which will be executed if the pattern matches:
|
||||
<details>
|
||||
|
||||
Key Points:
|
||||
* Match guards as a separate syntax feature are important and necessary.
|
||||
* Match guards as a separate syntax feature are important and necessary when we 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 result in other arms
|
||||
of the original `match` expression being considered.
|
||||
* You can use the variables defined in the pattern in your if expression.
|
||||
|
Reference in New Issue
Block a user