Map

A map is an unordered group of elements of one type, called the element type, indexed by a set of unique keys of another type, called the key type.

The key type must not be a function, map or slice.


map[string]int
                        

The number of map elements is called the length. For an M map, it can be discovered using the built-in len() function and can change during runtime.

A new empty map value is created using the make built-in function, which takes the type of map and an optional capability hint as arguments:


make(map[string]int)
make(map[string]int, 100)
                        
map_type.go