-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Update 'let is used to introduce variables' paragraph #24149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.