mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-21 23:45:42 +02:00
Add speaker note about for
and array refs (#2665)
This commit is contained in:
parent
a4469e7a91
commit
526dddce72
@ -3,3 +3,11 @@
|
|||||||
```rust,editable
|
```rust,editable
|
||||||
{{#include exercise.rs:solution}}
|
{{#include exercise.rs:solution}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
- Note that in `normalize` we were able to do `*item /= mag` to modify each
|
||||||
|
element. This is because we're iterating using a mutable reference to an
|
||||||
|
array, which causes the `for` loop to give mutable references to each element.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user