Tinderbox v9 Icon

Dictionary[keyStr]


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Dictionary, Set & List operations  [other Dictionary, Set & List operations operators]

 Baseline

 As at baseline


Dictionary[keyStr]

returns the Dictionary's value for the submitted keyStr string. For example, make a dictionary:

$MyDictionary={cat:animal; dog:animal; rock: mineral}; 

or (now deprecated):

$MyDictionary="cat:animal; dog:animal; rock: mineral"; 

then test like so:

$MyString = $MyDictionary["dog"]; 

sets MyString to the string "animal".

It is not required to use quotes around keyStr.

The keyStr may also be a (loop) variable, or an attribute value. The latter are evaluated before use:

$MyList.each(anItem){$MyString = $MyString + ", " + $MyDictionary[anItem];} 

$MyString = $MyDictionary[$SomeAttribute];} 

This has the same effect as .at( ), but may be more convenient. Note that in both the square-bracket syntax and .at() syntax a numerical key value is interpreted as a key and not a list item number, unlike List/Set.at().