From 526dddce7256aaeee289b5fa512e63bb65f2fcba Mon Sep 17 00:00:00 2001 From: Nicole L Date: Fri, 28 Feb 2025 10:31:15 -0800 Subject: [PATCH] Add speaker note about `for` and array refs (#2665) --- src/references/solution.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/references/solution.md b/src/references/solution.md index b4a4c92c..5517c2d4 100644 --- a/src/references/solution.md +++ b/src/references/solution.md @@ -3,3 +3,11 @@ ```rust,editable {{#include exercise.rs:solution}} ``` + +
+ +- 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. + +