mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Rollup merge of #26174 - mcast:trpl-assignment-empty-tuple, r=steveklabnik
Doc patch for #26120. Extra words here, because "value" is repeated. I haven't read about whether/how it should go to stable (sorry), but I think it would help newcomers. Thanks,
This commit is contained in:
commit
c8519c9793
@ -144,7 +144,9 @@ an expression, and a `let` can only begin a statement, not an expression.
|
||||
Note that assigning to an already-bound variable (e.g. `y = 5`) is still an
|
||||
expression, although its value is not particularly useful. Unlike other
|
||||
languages where an assignment evaluates to the assigned value (e.g. `5` in the
|
||||
previous example), in Rust the value of an assignment is an empty tuple `()`:
|
||||
previous example), in Rust the value of an assignment is an empty tuple `()`
|
||||
because the assigned value can have [just one owner](ownership.html), and any
|
||||
other returned value would be too surprising:
|
||||
|
||||
```rust
|
||||
let mut y = 5;
|
||||
|
Loading…
Reference in New Issue
Block a user