Closed NathanielRN closed 3 years ago
@jzarnett merge?
So I looked at this but the original version without the mut
added to x and y still compiles. The new declarations of let x =...
and let y = ...
are an example of shadowing. So they don't have to be mutable for the example to compile and run.
Now, I didn't watch the video segment again before writing this, so maybe there's something else in the video referencing the variables that means it makes sense for them to be mut
?
@NathanielRN
I'll close this since you said it works! Although I would say that's it's confusing to use the same value as the function argument variable even if it works with shadowing...
I would say shadowing is fine, but putting three variable declarations on the same line isn't great.
As mentioned in Lecture 18 @ 12:50 the y value (and I'm assuming the z value?) need to be mutable
mut
in the function signature.