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.
125125#### On iterators:
126126
127127``` rust
128- # let lines = " hello\ n world" . lines ();
128+ let lines = " hello\ n world" . lines ();
129+
129130for (linenumber , line ) in lines . enumerate () {
130131 println! (" {}: {}" , linenumber , line );
131132}
@@ -134,10 +135,8 @@ for (linenumber, line) in lines.enumerate() {
134135Outputs:
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
@@ -195,7 +194,7 @@ for x in 0..10 {
195194You may also encounter situations where you have nested loops and need to
196195specify which one your ` break ` or ` continue ` statement is for. Like most
197196other 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
199198of the outer loops, you can use labels to specify which loop the ` break ` or
200199 ` continue ` statement applies to. This will only print when both ` x ` and ` y ` are
201200 odd:
You can’t perform that action at this time.
0 commit comments