6.0

Table Of Contents
11
You define an array using the define() command, and assign values to individual elements using the
assignment operator (:=), the set() command or the put() command. You retrieve the value of an
individual element using either the get() command, or the name of the array followed by the position of
that element in the array. The position is an integer value starting at 0 for the first element of the array,
and incrementing by one for each additional element. See “Define (procedure)” on page 83, “Set
(procedure)” on page 136, “Put (procedure)” on page 127, and “Get (function)” on page 100.
As an example, consider &tax_rates, an integer array containing five elements (10 20 30 40 50). You
define the array as follows:
define( &tax_rates,arrayinteger,[10,20,30,40,50] )
You can use any of the following to change the value of the third element from 30 to 32.
&tax_rates[2] := 32
&tax_rates, 2, 32
put( &tax_rates, 2, 32 )
You can use any of the following to reference the third element in the array:
&tax_rates[2]
get(&tax_rates, 2)
For example:
&due := mul( &gross,&tax_rates[2] )
&due := mul( &gross,get(&tax_rates,2) )
Directory
The directory type is a type of string array in which each element in the array contains a pathname. All
pathnames in the array reference a file in the same folder. The number of elements in the array, and the
initial value of each element are both determined dynamically at the time the array is created. You specify
the folder, and the filter you want to apply to the list of files in that folder. When PlanetPress Talk creates
the array, it locates the folder you specified, applies the filter to the list of files that folder contains, and
then for each file that meets the filter criteria, adds its pathname to the directory array. Pathnames may
be either printer pathnames or host pathnames.
You can subsequently set the value of any of the elements in the array, as you would for any element in an
array of type string.
Code Sample Example 1
Example 1 uses a directory on the root drive of a printer.
Example 1
define(&MyVar,directory,'*') %root of the printer