Skip to content
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

Merged
merged 1 commit into from
Apr 21, 2015
Merged

TRPL: if let #24643

merged 1 commit into from
Apr 21, 2015

Conversation

steveklabnik
Copy link
Member

and while let

@rust-highfive
Copy link
Collaborator

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
Copy link

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.

Copy link
Member Author

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 :)

Copy link

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.

Copy link
Member Author

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:
Copy link

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:

and while let
@steveklabnik
Copy link
Member Author

@jakub- thanks! Addressed on all fronts, and better for it. 😄

@ghost
Copy link

ghost commented Apr 21, 2015

Sweet!

@bors r+ 570b250 rollup

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Apr 21, 2015
bors added a commit that referenced this pull request Apr 21, 2015
@bors bors merged commit 570b250 into rust-lang:master Apr 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants