Variable Values
The value of the variable,
which is the value the variable name represents, might be categorized
as follows:
- A constant, which is a number that is expressed
as:
- An integer (12)
- A decimal (12.5)
- A floating point number (1.25E2)
- A signed number (-12)
- A string constant (' 12')
- A string, which is one or more words that
may or may not be enclosed in quotation marks, such as:
This value is a string. 'This value is a literal string.'
- The value from another variable, such as:
variable1 = variable2
In the above example,
variable1
changes to the value ofvariable2
, butvariable2
remains the same. - An expression, which is something that needs
to be calculated, such as:
variable2 = 12 + 12 - .6 /* variable2 becomes 23.4 */
Before a variable is assigned a value, the variable displays the
value of its own name translated to uppercase. In the following example,
if the variable
new
was not assigned a previous value,
the word "NEW" is displayed. SAY new /* displays NEW */