Update 'let is used to introduce variables' paragraph#24149
Update 'let is used to introduce variables' paragraph#24149bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
|
Thanks for @jorisgio reminding me that the binding of But consider this: fn main() {
let (x, (y,));
x = 10;
y = true;
}playpen I still suggest there's no "variable definition" in Rust. |
|
In my opinion, in |
src/doc/complement-design-faq.md
Outdated
There was a problem hiding this comment.
there should be a newline after this, to make a new paragraph. also, the wrapping seems a bit odd.
|
The official term is 'variable bindings', though sometimes, people just say one or the other. |
src/doc/complement-design-faq.md
Outdated
There was a problem hiding this comment.
I would prefer to change this to "Why is let used to introduce variables?"
|
I do think this needs improvement and this is overall an improvement, just some nits :) |
|
Thanks :) |
|
@bors: r+ rollup |
|
📌 Commit c9454b1 has been approved by |
I think "let is used to introduce variables" is incorrent.
You can use
```rust
match (42, true) {
(x, y) => { /* ... */ }
}
```
to replace
```rust
let x = 42;
let y = true;
```
so it's nothing special for `let`.
There was a problem hiding this comment.
I missed a case here: for-in also do pattern matching.
I'll try update it.
I think "let is used to introduce variables" is incorrent.
You can use
to replace
so it's nothing special for
let.