I forgot the terminology of this. In Python, if you let a=1, later you can re-assign a="letter".
But in some languages, once you let a=1, a has to stay as an integer forever.
What do we call this in textbook?
I forgot the terminology of this. In Python, if you let a=1, later you can re-assign a="letter".
But in some languages, once you let a=1, a has to stay as an integer forever.
What do we call this in textbook?
This is called statically-typed vs. dynamically-typed. In a dynamically typed language, you must define a variable with a type and it must keep that type forever.
This makes sense when you consider the meaning of the word 'static'. Something which is static is immutable i.e. is immutable. Likewise, 'dynamic' things or items can be changed freely.
For example, in C:
int x = 1;
x = "string?";
returns
error: invalid conversion from 'const char*' to 'int'
While in a language like Python, you can freely reuse variables, like this:
x = 1
x = "string?"
would return no error.
Dynamic typing. Also related, in Python, to weak typing.
Answer is wrong, see comments. Leaving it here as it brings value in being corrected.