Why the variable is not modified inside a function with suffix "!"

The exclamation mark doesn’t do any work at all, it’s just a naming convention.

The difference between the two cases is that in the first case you just create a new local binding for the variable name a. In the second case you update the content of the mutable object that vec points to.

6 Likes