Next: Data Classes, Previous: Expressions, Up: Expressions [Contents][Index]
A variable is a name to which a value can be assigned. In LUX, whenever you assign a value to a variable, the variable takes on the data class and type of the value you assigned to it (with the exception of pointer variables (see Pointers). So, the set of assignments
x
= 17.3x
= 'Jabberwocky'
first makes variable x
be a float
, and then a string
.
Names of variables must start with a letter or one of the characters $ ! #. Following characters in the names of variables must be letters, digits, or the character _. Variables are either local or global.
Reserved keywords cannot be used as names of variables.
• Local Variables: | Variables that are local to a routine | |
• Global Variables: | Variables that are accessible everywhere | |
• Reserved Keywords: | Words that you cannot use as variable names |