mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 21:51:17 -06:00
@@ -1209,7 +1209,7 @@ This gets rid of a lot of nesting that would be necessary if we used `loop`,
|
|||||||
`if`, `else`, and `break`, and it's more clear. While a condition holds, run
|
`if`, `else`, and `break`, and it's more clear. While a condition holds, run
|
||||||
this code; otherwise, exit the loop.
|
this code; otherwise, exit the loop.
|
||||||
|
|
||||||
#### Looping Though a Collection with `for`
|
#### Looping Through a Collection with `for`
|
||||||
|
|
||||||
We could use this `while` construct to loop over the elements of a collection,
|
We could use this `while` construct to loop over the elements of a collection,
|
||||||
like an array. For example:
|
like an array. For example:
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ This gets rid of a lot of nesting that would be necessary if we used `loop`,
|
|||||||
`if`, `else`, and `break`, and it's more clear. While a condition holds, run
|
`if`, `else`, and `break`, and it's more clear. While a condition holds, run
|
||||||
this code; otherwise, exit the loop.
|
this code; otherwise, exit the loop.
|
||||||
|
|
||||||
#### Looping Though a Collection with `for`
|
#### Looping Through a Collection with `for`
|
||||||
|
|
||||||
We could use this `while` construct to loop over the elements of a collection,
|
We could use this `while` construct to loop over the elements of a collection,
|
||||||
like an array. For example:
|
like an array. For example:
|
||||||
|
|||||||
Reference in New Issue
Block a user