This is in reference to the following text in chapter 2:
Is there a better way to explain or describe things? I'm just having problems trying to reconcile (a) having to use 'mut' with (b) the vector type being a growable type in the first place. Perhaps it's a language design (i.e. making the 'mut' explicit), in which case this should be pointed out as such?
Help get this topic noticed by sharing it on Twitter, Facebook, or email.
It's a language design thing.
Rust variables are immutable by default. So if you're going to change the value in a variable after it's initialized, you must declare the variable
mut, whether it's a
Vec, an integer, or something else.
We've changed the text to:
Even though vectors are designed to be grown and shrunk dynamically, we must still mark the variable `mut` for Rust to let us push numbers onto the end of it.
Is that any better?