mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-22 06:51:58 +02:00
Update if-expressions.md (#236)
* Update if-expressions.md Adding a note about types of `if` branch blocks. * Fix typo and simplify. Co-authored-by: Andrew Walbran <qwandor@google.com>
This commit is contained in:
parent
20e83166f4
commit
6b6c553789
@ -25,3 +25,9 @@ fn main() {
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
Because `if` is an expression and must have a particular type, both of its branch blocks must have the same type. Consider showing what happens if you add `;` after `x / 2` in the second example.
|
||||
|
||||
</details>
|
||||
|
Loading…
x
Reference in New Issue
Block a user