Associative array/Creation: Difference between revisions
→{{header|langur}}
Langurmonkey (talk | contribs) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 3,933:
Hash keys in langur may be numbers or strings. Number keys are simplified, so that 1.0 is the same key as 1.
<syntaxhighlight lang="langur">var .hash =
# may assign with existing or non-existing hash key (if hash is mutable)
Line 6,035:
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">var hash = Hash
key1 => 'value1',
key2 => 'value2',
)
# Add a new key-value pair
hash{:key3} = 'value3'
=={{header|Slate}}==
Line 6,419:
=={{header|Wren}}==
Wren has a Map class built in.
<syntaxhighlight lang="
fruit[1] = "orange" // associates a key of 1 with "orange"
fruit[2] = "apple" // associates a key of 2 with "apple"
Line 6,448:
null
</pre>
=={{header|XLISP}}==
|