April 2012
Intermediate to advanced
288 pages
4h 39m
English
Go, in common with most other languages, provides arrays as a fundamental low-level collection type. It adds slices on top of arrays to provide a safe way of accessing arbitrary memory ranges.
In the standard library, Go also provides a small range of collection types, but there’s also one more that is part of the language: maps. Other languages call these dictionaries, associative arrays, or (not quite accurately) hash tables. They define a unique set of keys, each of which has one value associated with it.
1 package main 2 import "fmt" 3 4 type Any interface {} 5 6 func main() { 7 a := make(map[int] string) 8 b := make(map[Any] int) 9 a[12] = "A string in ...
Read now
Unlock full access