suve

awful: function: dict

Declaration

dict :dict ( string $KEY , mixed $VAL , … )

Summary

Creates a dictionary. Arguments passed are treated as key-value pairs: the second-leftmost argument will be copied and put as value under the index taken from the most value. Can take any number of such pairs.

Example

# Dictionary example.
:set &D :dict s'one' s'eins' s'two' s'zwei' s'three' s'drei'
:set &D[s'four'] s'vier'
:set &K :dict-keys &D
:set &V :dict-values &V
:set &C i0
!while :lt $C :dict-count &D
    :writeln $K[$C] s' == ' $V[$C]
    :add &C i1
    !done

wikipage modified on 2014/0601/2317