DICTIONARY

A dictionary defines an associative array (hash-map) of elements.

Syntax

DICTIONARY [ attributes-list ] OF data-type
where attributes-list is:
ATTRIBUTES ( attribute [ = "value" ] [,...] )
  1. data-type can be a data type, a record definition, a user defined type, a built-in class, an imported package class, or a Java class.
  2. attribute is an attribute to extend the dictionary definition with properties.
  3. value is the value for the dictionary definition attribute, it is optional for boolean attributes.

Usage

A dictionary defines an associative array of unordered elements, accessed by a key.

Dictionary variables can invoke methods specific to the dictionary types.

The elements of the dictionary can be of a simple type, or structured records.

For example, to define a dictionary of strings:
DEFINE dict DICTIONARY OF STRING

The dictionary subscript syntax consists of a character string expression (the key), specified between square brackets.

The result of the subscript syntax can be used as l-value (as target variable in assignments):

LET dict["abcdef"] = "the value"

or as r-value (in expressions):

DISPLAY dict["abcdef"]

Dictionary elements are automatically created when needed. For more details, see DICTIONARY in action.