File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,8 @@ Don't forget to add the parentheses around the range.
125
125
#### On iterators:
126
126
127
127
``` rust
128
- # let lines = " hello\ n world" . lines ();
128
+ let lines = " hello\ n world" . lines ();
129
+
129
130
for (linenumber , line ) in lines . enumerate () {
130
131
println! (" {}: {}" , linenumber , line );
131
132
}
@@ -134,10 +135,8 @@ for (linenumber, line) in lines.enumerate() {
134
135
Outputs:
135
136
136
137
``` 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
141
140
```
142
141
143
142
## Ending iteration early
@@ -195,7 +194,7 @@ for x in 0..10 {
195
194
You may also encounter situations where you have nested loops and need to
196
195
specify which one your ` break ` or ` continue ` statement is for. Like most
197
196
other languages, by default a ` break ` or ` continue ` will apply to innermost
198
- loop. In a situation where you would like to a ` break ` or ` continue ` for one
197
+ loop. In a situation where you would like to ` break ` or ` continue ` for one
199
198
of the outer loops, you can use labels to specify which loop the ` break ` or
200
199
` continue ` statement applies to. This will only print when both ` x ` and ` y ` are
201
200
odd:
You can’t perform that action at this time.
0 commit comments