Map Syntax

We write maps by enclosing alternating keys and values in curly braces, like so.

Maps are useful because they can hold data in a way we normally think about it.

Take our made up example, Sally Brown. A map can hold her first name and last name, her address, her favourite food, or anything else.

It's a simple way to collect that data and make it easy to look up. The last example is an empty map. It is a map that is ready to hold some things, but doesn't have anything in it yet.

{:first "Sally" :last "Brown"}
{:a 1 :b "two"}



results matching ""

    No results matching ""