Associative array/Merging: Difference between revisions

Added AppleScript.
(Added AppleScript.)
Line 106:
color: red
</pre>
 
=={{header|AppleScript}}==
 
The method with AppleScript "records" is to concatenate them. The result is a third record containing the labels from both contributors, the values from the record to the left of the operator being kept where labels are shared. The bars with some of the labels below are to distinguish them as "user" labels from tokenised ones that are provided as standards for use by scriptable applications and scripting additions. However, merging records works with tokenised labels too.
 
<lang applescript>set baseRecord to {|name|:"Rocket Skates", price:12.75, |color|:"yellow"}
set updateRecord to {price:15.25, |color|:"red", |year|:1974}
 
set mergedRecord to updateRecord & baseRecord
return mergedRecord</lang>
 
{{output}}
<lang applescript>{price:15.25, |color|:"red", |year|:1974, |name|:"Rocket Skates"}</lang>
 
=={{header|AutoHotkey}}==
557

edits