Hash (associative array)

Hash, or associative array, allows storing associations between string keys and some values. Hash is created automatically-when a variable is assigned or a method is called-the following way:

$hash_name[
    $.key1[value]
    $.key2[value]
    . . .
    $.keyN[value]
]

or

^method[
    $.key1[value]
    $.key2[value]
    . . .
    $.keyN[value]
]

You can also create an empty hash or a copy of another hash. See "Creating an empty hash or copying existing hash".

To retrieve a value stored in a hash key use construction:

$hash_name.key

Hash allows building multi-level structures, for example,
hash of hash where key values would be other hashes. Example:

$name[
    $.key1_of_level1[$.key1_of_level2[value]]
    . . . 
    $.keyN_of_level1[$.keyN_of_level2[value]]
]



Copyright © 1997–2017 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 01.04.2004