2 variable declarations, Variable declarations – Rice Lake iRite IDE User Manual
Page 22

18
920i
Programming Reference
A : integer
B : real
end database;
;
Array Type Definitions
An array type definition describes a container for an ordered collection of identically typed objects. The
container is organized as an array of one or more dimensions. All dimensions begin at index 1.
array '['
;
ARRAY
END
expr-list
type
[
]
Figure 3-7. Array Type Definition Syntax
Examples:
type Weights is array [25] of Real;
An array consisting of user-defined records could be defined as follows:
type Employees is array [100] of EmployeeRecord;
A two-dimensional array in which each dimension has an index range of 10 (1…10), for a total of 100 elements
could be defined as follows:
type MyArray is array [10,10] of Integer;
Note
In all of the preceding examples, no variables (objects) are created, no memory is allocated by the type
definitions. The type definition only defines a type for use in a later variable declaration, at which time
memory is allocated.
3.3.2
Variable Declarations
A variable declaration creates an object of a particular type. The type specified must be a previously defined
user- or system-defined type name. The initial value, if specified, must be type-compatible with the declared
object type. All user-defined variables must be declared before being used.
Variables declared with the keyword stored cause memory to be allocated in battery-backed RAM. Stored data
values are retained even after the indicator is powered down.
Variables declared with the keyword constant must have an initial value.
IDENTIFIER ':'
;
/* NULL */
| stored
;
/* NULL */
| constant
;
/* NULL */
| :=
;
Example:
MyVariable : StopLightColor;