mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 20:34:52 -06:00
Merge pull request #362 from dawirstejeck/off_by_one
Fix off-by-one mistake in while loop explanation
This commit is contained in:
@@ -383,7 +383,7 @@ the value is: 50
|
|||||||
```
|
```
|
||||||
|
|
||||||
All five array values appear in the terminal, as expected. Even though `index`
|
All five array values appear in the terminal, as expected. Even though `index`
|
||||||
will reach a value of `6` at some point, the loop stops executing before trying
|
will reach a value of `5` at some point, the loop stops executing before trying
|
||||||
to fetch a sixth value from the array.
|
to fetch a sixth value from the array.
|
||||||
|
|
||||||
But this approach is error prone; we could cause the program to panic if the
|
But this approach is error prone; we could cause the program to panic if the
|
||||||
|
|||||||
Reference in New Issue
Block a user