Skip to content

Commit de910b9

Browse files
committed
Fix issues w/ listings 8.7/8.8. Closes #385
1 parent 4a55c2c commit de910b9

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/ch08-01-vectors.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ ending up in that situation.
157157
158158
### Iterating Over the Values in a Vector
159159

160-
<!-- BEGIN INTERVENTION: e8da8773-8df2-4279-8c27-b7e9eda1dddd -->
161160
To access each element in a vector in turn, we would iterate through all of the
162161
elements rather than use indices to access one at a time. Listing 8-7 shows how
163162
to use a `for` loop to get immutable references to each element in a vector of
@@ -171,7 +170,7 @@ to use a `for` loop to get immutable references to each element in a vector of
171170

172171
</Listing>
173172

174-
To read the number that `n_ref` refers to, we have to use the `*` dereference operator to get to the value in `n_ref` before we can add 1 to it, as covered in ["Dereferencing a Pointer Accesses Its Data"][deref].
173+
To read the number that `i` refers to, we have to use the `*` dereference operator to get to the value in `i` before we can add 1 to it, as covered in ["Dereferencing a Pointer Accesses Its Data"][deref].
175174

176175
We can also iterate over mutable references to each element in a mutable vector
177176
in order to make changes to all the elements. The `for` loop in Listing 8-8
@@ -185,8 +184,7 @@ will add `50` to each element.
185184

186185
</Listing>
187186

188-
To change the value that the mutable reference refers to, we again use the `*` dereference operator to get to the value in `n_ref` before we can use the `+=` operator.
189-
<!-- END INTERVENTION -->
187+
To change the value that the mutable reference refers to, we again use the `*` dereference operator to get to the value in `i` before we can use the `+=` operator.
190188

191189
{{#quiz ../quizzes/ch08-01-vec-sec1.toml}}
192190

0 commit comments

Comments
 (0)