Skip to content

Commit a3c9afa

Browse files
committed
addressed review comments - grammar corrections, space additions
1 parent 9bf73d2 commit a3c9afa

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/doc/book/vectors.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -114,30 +114,37 @@ for i in v {
114114
println!("Take ownership of the vector and its element {}", i);
115115
}
116116
```
117-
Note: You cannot use the vector again once you have iterated with ownership of the vector.
118-
You can iterate the vector multiple times with reference iteration. For example, the following
119-
code does not compile.
117+
118+
Note: You cannot use the vector again once you have iterated by taking ownership of the vector.
119+
You can iterate the vector multiple times by taking a reference to the vector whilst iterating.
120+
For example, the following code does not compile.
121+
120122
```rust
121123
let mut v = vec![1, 2, 3, 4, 5];
124+
122125
for i in v {
123126
println!("Take ownership of the vector and its element {}", i);
124127
}
128+
125129
for i in v {
126130
println!("Take ownership of the vector and its element {}", i);
127131
}
128132
```
133+
129134
Whereas the following works perfectly,
130135

131136
```rust
132137
let mut v = vec![1, 2, 3, 4, 5];
138+
133139
for i in &v {
134-
println!("A mutable reference to {}", i);
140+
println!("This is a reference to {}", i);
135141
}
136142

137143
for i in &v {
138-
println!("A mutable reference to {}", i);
144+
println!("This is a reference {}", i);
139145
}
140146
```
147+
141148
Vectors have many more useful methods, which you can read about in [their
142149
API documentation][vec].
143150

0 commit comments

Comments
 (0)