[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Are variables immutable?
- From: Duke Normandin <dukeofpurl@...>
- Date: Wed, 25 May 2022 10:35:41 -0600
On Wed, 25 May 2022 11:11:42 -0500
Javier Guerra Giraldez <firstname.lastname@example.org> wrote:
> On Wed, 25 May 2022 at 11:03, Duke Normandin <email@example.com>
> > My mistake! However I set myName = 'blah' which is a string!
> > Correct? I can then say myName = 'blah-blau' and no error
> > message shows up.
> > I'm missing something!
THANK YOU very much Javier for bottom posting your reply!
Much appreciated from this old-school noob!
> be mindful about the difference between values and variables.
> myName is a variable. it can hold any value, and can be changed
> to any other value
> "blah" is a string. it won't change. it will always be "blah"
So a Lua string is like a string constant in C?
> when you change myName, it changes the variable, not the value.
That does NOT make sense to me! The variable name, i.e. myName is
not changed. The contents of variable myName has been changed to
I get it that 'blah' and 'blah-blau' are 2 different strings and
are set in stone. But I don't see the point of even bringing the
subject of string immutability unless it's in the context of they
** Text only please. Bottom post works best for me **