From 0e16b3c8a655b8aba5a829e735f3921d3b4b466e Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Wed, 10 Oct 2012 12:37:57 -0700 Subject: [PATCH] maps --- examples.txt | 2 +- examples/maps/maps.go | 5 +++-- examples/maps/maps.sh | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples.txt b/examples.txt index a95e012..e7501c6 100644 --- a/examples.txt +++ b/examples.txt @@ -8,7 +8,7 @@ Hello World # Switch # Arrays # Slices -# Maps +Maps # Range # Functions # Multiple Return Values diff --git a/examples/maps/maps.go b/examples/maps/maps.go index 8f55959..3181c13 100644 --- a/examples/maps/maps.go +++ b/examples/maps/maps.go @@ -1,11 +1,12 @@ -// Maps are Go's built-in associative data type (sometimes -// called "hashes" or "dicts" in other languages). +// Maps are Go's built-in [associative data type](http://en.wikipedia.org/wiki/Associative_array) +// (sometimes called _hashes_ or _dicts_ in other languages). package main import "fmt" func main() { + // To create an empty map, use the builtin `make`: // `make(map[key-type]val-type)`. m := make(map[string]int) diff --git a/examples/maps/maps.sh b/examples/maps/maps.sh index c081d1a..0ae4194 100644 --- a/examples/maps/maps.sh +++ b/examples/maps/maps.sh @@ -1,3 +1,5 @@ +# Note that maps appear in the form `map[k:v k:v]` when +# printed with `fmt.Println`. $ go run maps.go map: map[k1:7 k2:13] v1: 7