No. Memory is found for a variable the first time it is used in a statement.
LET Statement
The second LET statement
changes the contents of the variable.
LET NUMBER = 45.1 ' put 45.1 into NUMBER (erasing the 23.5)
NUMBER already exists,
no new memory is found for it.NUMBER.
If you think of a variable as a box,
the box can only hold one thing.
So after the second LET statement:
|
Now the second PRINT statement executes.
It looks into NUMBER, finds
45.1, and prints that to the screen.
The PRINT statement
does not change the contents of NUMBER.
Look again at the complete program:
' Changing the contents of a variable ' LET NUMBER = 23.5 ' create NUMBER, put 23.5 into it PRINT "First", NUMBER ' look in NUMBER to find a value to print LET NUMBER = 45.1 ' put 45.1 into NUMBER (erasing the 23.5) PRINT "Second", NUMBER ' look in NUMBER to find a value to print END
What do you expect will be printed to the screen?