-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
TRPL: if let #24643
TRPL: if let #24643
Conversation
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
} | ||
``` | ||
|
||
If a [pattern][patterns] matches successfully, it binds any appropriate things |
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.
“things” seems too colloquial to my taste.
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 wasn't sure what word to use exactly, suggestions welcome :)
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.
Ah, sorry, maybe “binds any appropriate parts of the value to the identifiers in the pattern”? subvalues or substructures seem too jargony on the contrary.
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.
👍
## `while let` | ||
|
||
In a similar fashion, `while let` can be used when you want to loop over the | ||
result of a pattern. It turns code like this: |
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.
Same here. It's not clear what is meant by “result of a pattern” since that's not a term we seem to use at all. Maybe:
In a similar fashion,
while let
can be used when you want to conditionally loop as long as a value matches a certain pattern. It turns code like this:
6ef2f3c
to
570b250
Compare
and while let
@jakub- thanks! Addressed on all fronts, and better for it. 😄 |
and while let