Hotcakes, you have a point. (I was wondering the same thing.) =)
Fredborg, that makes sense.
I also wish to elaborate on your interesting fact. The variable "a" from the function is NOT the same as the constant "a". The "Return a" statement returns the "a" that is MOST local in scope, which is the "a" declared in the function declaration. (You can see that nothing happens to the constant "a" by putting "Print a" after the function call.)
In a nutshell, variables declared within functions are active only in that function, even if they have the same name as a global or const. The compiler does differentiate them (i.e. they don't have the same name to the compiler).
I know you know this, I presume it's what you meant by being "overwritten". I just wanted to elaborate for those who didn't know why that was.
Fredborg, that makes sense.
I also wish to elaborate on your interesting fact. The variable "a" from the function is NOT the same as the constant "a". The "Return a" statement returns the "a" that is MOST local in scope, which is the "a" declared in the function declaration. (You can see that nothing happens to the constant "a" by putting "Print a" after the function call.)
In a nutshell, variables declared within functions are active only in that function, even if they have the same name as a global or const. The compiler does differentiate them (i.e. they don't have the same name to the compiler).
I know you know this, I presume it's what you meant by being "overwritten". I just wanted to elaborate for those who didn't know why that was.