Data Types

dictionary

Supported By

Properties

keys, values

Description

The dictionary data type represents a map of strings to variants. In an XION script and in string form, a dictionary looks like:

{
  "4" = "Steve"
  "1" = "Bill"
  "3" = "Andy"
  "2" = "Dan"
}

In this example, the keys are the strings "4", "1", "3", and "2"; and the values are the strings "Steve", "Bill", "Andy", and "Dan". Keys must always be strings. Values may be any kind of variant.

A dictionary is manipulated using the entry chunk type. In this example, entry "2" of this dictionary evaluates to "Dan". An ordinal or numeric index on an entry is used as a key, not as an index; entry 4 of this dictionary evaluates to "Steve" even though "Steve" appears first in the dictionary.

You can iterate over the keys and values of a dictionary using the keys and values properties of a dictionary.