Maps, (AKA dictionaries), provide key-value data association. Ion has two variants of maps: BTree and Hash. Hash maps are fast but store data in a random order; whereas BTree maps are slower but keep their data in a sorted order. If not sure what to use, it's best to go with Hash maps.
Creating maps uses the same right-hand-side array syntax. However for design simplicity, users must annotate the type to translate the array into a map.
Please note, the map's inner type specifies the value's type and not of the key. Keys will always be typed
Create a HashMap
let hashmap:hmap[str] = [ foo=hello bar=world fizz=I buzz=was bazz=here ]
Create a BTreeMap
let btreemap:bmap[str] = [ foo=hello bar=world fizz=I buzz=was bazz=here ]
Fetch a variables by key
let x = bazz echo @hashmap[bar] @hashmap[$x]
Insert a new key
let x[bork] = oops
Iterate keys in the map
Iterate values in the map
Iterate key/value pairs in the map