pTAL Reference Manual (H06.08+)
Language Elements
HP pTAL Reference Manual—523746-006
2-10
Variables
Variables
A variable is a symbolic representation of data. It can be a single-element variable or a
multiple-element variable. You use variables to store data that can change during
program execution.
Before you can access data stored in a variable you must either:
•
Initialize the variable with a value when you declare the variable
•
Assign a value to the variable after you declare the variable
.
Scope
Every declared item in a pTAL program has a scope that determines where in the
program it is visible (after the point of declaration).
Formal parameters of procedures and subprocedures have local and sublocal scope,
respectively.
Table 2-9. Variable Types
Variable Type Description
Simple variable A variable that contains one element of a specified data type
Array A variable that contains multiple elements of the same data type
Structure A variable that can contain variables of different data types
Substructure A structure nested within a structure or substructure
Structure item A simple variable, array, simple pointer, substructure, or
structure pointer declared in a structure or substructure; also
known as a structure field
Nonstructure pointer A variable that contains a memory address, usually of a simple
variable or an array element, which you can access with this
nonstructure pointer
Structure pointer A variable that contains the memory address of a structure,
which you can access with this structure pointer
Scope Declared in a ... Visible ...
Global Program Everywhere in the program
Local Procedure Only in the procedure that declares it (including the
subprocedures of that procedure)
Sublocal Subprocedure Only in the subprocedure that declares it










