RosettaCodeData/Task/Associative-array-Merging/EasyLang/associative-array-merging.easy

16 lines
430 B
Text
Raw Permalink Normal View History

2024-10-16 18:07:41 -07:00
base$[][] = [ [ "name" "Rocket Skates" ] [ "price" 12.75 ] [ "color" "yellow" ] ]
update$[][] = [ [ "price" 15.25 ] [ "color" "red" ] [ "year" 1974 ] ]
2025-06-11 20:16:52 -04:00
proc update &a$[][] &b$[][] .
2024-10-16 18:07:41 -07:00
for b to len b$[][]
for a to len a$[][]
if a$[a][1] = b$[b][1]
a$[a][2] = b$[b][2]
break 1
.
.
2025-06-11 20:16:52 -04:00
if a > len a$[][] : a$[][] &= b$[b][]
2024-10-16 18:07:41 -07:00
.
.
update base$[][] update$[][]
print base$[][]