DICTIONARY

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

Syntax

DICTIONARY [ attributes-list ] OF type-specification
  1. type-specification can be one of:
  2. attributes-list is a comma-separated list of name = value pairs or name attributes, and defines attributes for the dictionary type.

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.