Skip to content

Conversation

steveklabnik
Copy link
Contributor

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
Contributor 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
Contributor

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
Contributor 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