Skip to content

Commit 7df3bf1

Browse files
committed
make this example more obvious
Fixes #31334
1 parent 91e8044 commit 7df3bf1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/doc/book/loops.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ Don't forget to add the parentheses around the range.
125125
#### On iterators:
126126

127127
```rust
128-
# let lines = "hello\nworld".lines();
128+
let lines = "hello\nworld".lines();
129+
129130
for (linenumber, line) in lines.enumerate() {
130131
println!("{}: {}", linenumber, line);
131132
}
@@ -134,10 +135,8 @@ for (linenumber, line) in lines.enumerate() {
134135
Outputs:
135136

136137
```text
137-
0: Content of line one
138-
1: Content of line two
139-
2: Content of line three
140-
3: Content of line four
138+
0: hello
139+
1: world
141140
```
142141

143142
## Ending iteration early

0 commit comments

Comments
 (0)