Zaidlang
Search
⌃K
📑

Maps

Maps — sometimes called associative arrays, hashes, or dictionaries in other programming languages, store a collection of key-value pairings. Maps are constructed as a comma-separated list of key-value pairs enclosed by curly braces. Each key-value pair uses a colon to differentiate between the key and the value.
{
"name": "Zaid",
"value": 57.3,
"handler": function(x) { return x * x}
}

Accessing Elements

You can access any element in a map by calling the subscript operator on it with the key of the element you want.
people = { Artemis: 35, Rabbit: 37, Orion: 43 }
​
printftw(people["Artemis"]) // >> 35
printftw(people["Rabbit"]) // >> 35
printftw(people["Orion"]) // >> 35
Calling a key that does not exist will return a null value.
printftw(people["Arasuka"]) // >> null