diff --git a/src/references/solution.md b/src/references/solution.md index 5517c2d401bc..f7b469b42b6d 100644 --- a/src/references/solution.md +++ b/src/references/solution.md @@ -10,4 +10,9 @@ 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. +- It is also possible to take slice references here, e.g., + `fn + magnitude(vector: &[f64]) -> f64`. This makes the function more general, + at the cost of a runtime length check. +