Constants and variables
A constant is a named data item with a predefined value, while a variable is a named data item whose value can change during the course of program execution. Variables can be either global or local.
All data is represented as one of three basic
data types:
- Int
- Integer data type ( + - followed by 1 or more digits 0–9).
- Real
- Floating point (+- followed by zero or more digits 0–9). Decimal point followed by 1 or more digits 0–9. Note that all numbers are stored internally as Float.
- String
- Any valid Unicode string enclosed within quotation marks.
- Constants
- A constant is a named data
item with a predefined value. You cannot
change the value assigned to a predefined constant. The predefined
constants are:
- NULL
- An empty reference. Similar to an empty pointer. Note that this is not the same as a null string "".
- TRUE
- Equivalent to the number 1.
- FALSE
- Equivalent to the number 0.
- Variable definitions
- A variable is
a named data item whose value can change during
the course of program execution. A variable name must follow the naming
convention of an Identifier (alphabetic character, numeric character,
and the underscore.) When more than one variable is defined on a single
declaration, the name must be separated by commas. Each variable declaration
must be terminated with a semi-colon. Variable names cannot be the
same as a reserved word. Note: Identifiers and Names in the script language are case-insensitive. Thus, abc is the same as ABC.
- Global and local variables
- Variables can be either global or local. A variable is global unless it is declared within a function definition. Global variables are visible and available to all statements in a script. Local variables are only visible and available within the function where they were defined. Although variable names and identifiers must be unique, it is valid to declare a local variable that has the same name as global, or the same name as a local variable defined in another function. Parameter names in a function definition are considered to be local variables. Data passed to a function is by value. A global variable passed to a function will not be changed by the function.