HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
3- 11
| DEC | |
| | |
---------------------------------------------------------------------------------------------
Variable declaration statements can appear anywhere in a program. In
the interpreter, before the main procedure or function is executed, HP
Business BASIC/XL allocates space for both explicitly and implicitly
declared variables. A variable cannot be explicitly declared more than
once in a program unit.
If a variable appears in a program line, but not in a declaration
statement, its name determines whether it is a numeric or string vari-
able and the context determines whether it is a scalar or an array.
Variable Names
Table 3-10 gives examples of numeric and string variables names.
Table 3-10. Variable Names
---------------------------------------------------------------------------------------------
||||
| Variable Type | Variable Name | Examples |
||||
---------------------------------------------------------------------------------------------
||||
| Numeric | Identifier | Sum |
||||
| | | Grand_total |
||||
|||X|
||||
---------------------------------------------------------------------------------------------
||||
| String | Identifier with $ appended | Name$ |
||||
| | | Date1$ |
||||
|||A$|
||||
---------------------------------------------------------------------------------------------
A variable name is recognized throughout the program unit that declares
it.
Within a program unit, the following items can have the same name:
* Scalar numeric variable.
* Scalar string variable.
* Numeric array variable.
* String array variable.
* Line label.
* Common area name.
Context determines whether the name refers to a scalar variable, an array
variable or a line label.
Example
The following are examples of declaring variables: