Programming instructions
60
Intermec Fingerprint 6.13 – Programmer's Guide
6. FILE SYSTEM, cont'd.
10. Arrays
Continued!
Variables containing related data may be organized in arrays. Each
value in an array is called an element. The position of each element
is specified by a subscript, one for each dimension (max 10). Each
array variable consists of a name and a number of subscripts
separated by commas and enclosed by parentheses, for example
ARRAY$(3,3,3).
The number of subscripts in an array variable, the first time
(regardless of line number) it is referred to, decides its number of
dimensions. The number of elements in each dimension is by
default restricted to four (No. 0–3).
Four instructions are specifically used in connection with arrays:
DIM Specifies the size of an array in regard of
elements and dimensions.
SORT Sorts the elements in a one-dimensional
array in ascending or descending order.
SPLIT Splits a string into an array.
CSUM Returns the checksum for a string array.
DIM
If more than 4 elements are needed, or if you want to limit the size
of the array, a DIM statement can be used to specify the size of the
array in regard of the number of dimensions as well as the number
of elements in each dimension. In most cases, one- or two-
dimensional arrays will suffice.
This example shows how three 1-dimensional, 5-element arrays
can be used to return 125 possible combinations of text strings:
10 DIM TYPE$(4),COLOUR$(4),SIZE$(4)
20 TYPE$(0)="SHIRT"
30 TYPE$(1)="BLOUSE"
40 TYPE$(2)="TROUSERS"
50 TYPE$(3)="SKIRT"
60 TYPE$(4)="JACKET"
70 COLOUR$(0)="RED"
80 COLOUR$(1)="GREEN"
90 COLOUR$(2)="BLUE"
100 COLOUR$(3)="RED"
110 COLOUR$(4)="WHITE"
120 SIZE$(0)="EXTRA SMALL"
130 SIZE$(1)="SMALL"
140 SIZE$(2)="MEDIUM"
150 SIZE$(3)="LARGE"
160 SIZE$(4)="EXTRA LARGE"
170 INPUT"Select Type (0-4): ", A%
180 INPUT"Select Colour (0-4): ", B%
190 INPUT"Select Size (0-4): ", C%
200 PRINT TYPE$(A%)+", "+COLOUR$(B%)+", "+SIZE$(C%)
RUN