7.4

Table Of Contents
0 for the first element of the array, and incrementing by one for each additional element. See "Define (procedure)" (page 561),
"Set (procedure)" (page 563), "Put (procedure)" (page 562), and "Get (function)" (page 543).
As an example, consider &tax_rates, an integer array containing five elements (10 20 30 40 50). You define the array as fol-
lows:
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 deter-
mined 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.
Variables
What are variables?
A variable is a value that changes over time, that has a specific type, and a defined scope. Variables have names to make it
possible to reference them. All variable names in PlanetPress begin with an ampersand. For example, &printermode.
Type The type of a variable defines what kind of data it contains and consequently what kinds of operations you can perform
on it. The following are the data types available in PlanetPress Talk: integer, measure, currency, string, boolean, array, color
array, and directory. See "Data Types" (page 222).
Scope The scope of a variable is the context in which it is available. There are two possible scopes: local and global. A local
scope means the variable is available only in the specific area of an object or group in which it is defined, and a global scope
means the variable is available anywhere you can enter PlanetPress Talk code. The way you define a variable determines its
scope. The variables you define using the define command have a local scope limited to the area of the object or group in
which you define them. The variables you define as global variables in PlanetPress have a global scope. Global variables in
PlanetPress appear in the Global Variables area of TreeView.
There are a number of ways to use variables in documents. See the PlanetPress User Guide for examples of some of the
most common uses people make of variables.
©2010 Objectif Lune Inc - 224 -