1
0
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:
Marko Zagar
2023-02-09 21:15:47 +00:00
committed by GitHub
parent e3b4b6a5c7
commit 36ce63cb10
5 changed files with 10 additions and 7 deletions

View File

@ -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.