Skip to content

Remove use of range() in iterator docs. #22296

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

Merged
merged 1 commit into from
Feb 18, 2015
Merged

Conversation

steveklabnik
Copy link
Member

Fixes #21577.

@rust-highfive
Copy link
Contributor

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)


```{rust}
```rust
let nums = vec![1, 2, 3];

for i in range(0, nums.len()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

range

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol and others, fixed them too

@@ -4,20 +4,20 @@ Let's talk about loops.

Remember Rust's `for` loop? Here's an example:

```{rust}
for x in range(0, 10) {
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rust disappeared :(

```{rust}
let sum = range(1, 4)
```rust
let sum = 1..4
.fold(0, |sum, x| sum + x);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parentheses needed around (1..4) here, else it is 1..(4.fold(---))

@steveklabnik
Copy link
Member Author

Feedback addressed. @gankro r?

@Gankra
Copy link
Contributor

Gankra commented Feb 16, 2015

@bors r+ 817f3 rollup

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 17, 2015
@huonw huonw merged commit 817f3a4 into rust-lang:master Feb 18, 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.

Redefining range in this rust_book example may be confusing
7 participants