Dictionary get index
This block is used to obtain value for given key from dictionary. Left part defines the source dictionary. Right part defines the key, whose value we want to obtain. Block returns value of the key.
In case specified key does not exist block returns None. However this state should be fixed.
XML representation of dictionaries_get_index block
<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="dictionaries_get_index">
<mutation statement="false" at="true"/>
<value name="VALUE">
<block type="variables_get">
<field name="VAR">dictionary</field>
</block>
</value>
<value name="AT">
<block type="text">
<field name="TEXT">key</field>
</block>
</value>
</block>
</xml>
Block is used on the row “if in dictionary item” in the example. It reads the value of the “user” key in “item” dictionary. Value is compared with word “administrator” and if there is a match, new key “admin” with value “true” is saved into the “item” dictionary.