Conclusion of the lessons on arrays
In the previous lessons we have seen the most advanced words for the array namespace.Now it is time for you to discover for yourself the other words in that namespace. Learning a language is best done using it. So please play with these words!
What is a map in 8th?
A map is a collection of key / value pairs. The keys are unique within a map. Instead of referencing an item by index (like with arrays) you must reference an item by key.Keys must be strings in 8th. Values can be of any type.
Creating a new map
So, a literal map is surrounded by braces.
Keys and values must be separated by a colon and key/value pairs must be delimited by a comma.
Note that the colon and the comma (here) are NOT 8th words, but just syntax.
Retrieving a value for a specific key

In order to retrieve the map itself, we need G:@.
In order to retrieve the value for a key we need m:@.
Storing a value in a map using m:!
Note that the order of key/value pairs is arbitrary! This kind of container is not suited for sequential in order access.
Removing a key with it’s value from a map using m:-
Iterating over a map using m:each
Note that this works almost exactly the same as for arrays.
Conclusion on maps
There are a few more very useful words for maps.For now I will leave you with “homework”
- Study the SED’s for the array and map namespace
- Try out some words for yourself
- Never ever give up!
- Post any interesting piece of code in the forum
If you need help, please ask any question and report any problem you may have in the forum! Today I made a stupid mistake and finally asked in the forum. It’s really not a shame whatsoever.
More info about 8th
8th Website: http://8th-dev.com8th Forum: http://8th-dev.com/forum
My YouTube Channel: https://goo.gl/DscYVD
My BLOG: http://goo.gl/n1NocJ
The Big 8th Lessons Book: http://goo.gl/qDa6fH









