0
Mutable string
What does it mean when string is "mutable"?
2 Réponses
+ 3
It means you can change it.
If your string was immutable and you wanted to change the first character, you would have to create a new string and copy the contents over (or it's done automatically for you, depends on the language).
But since the string is mutable you can just change the existing string. This may have unintended consequences, if different parts of your code use the same string. You might change it in places where you didn't mean to.
+ 1
Thank you so much! 😊