This commit is contained in:
Mark McGranaghan 2012-10-10 12:37:57 -07:00
parent d75280c111
commit 0e16b3c8a6
3 changed files with 6 additions and 3 deletions

View File

@ -8,7 +8,7 @@ Hello World
# Switch # Switch
# Arrays # Arrays
# Slices # Slices
# Maps Maps
# Range # Range
# Functions # Functions
# Multiple Return Values # Multiple Return Values

View File

@ -1,11 +1,12 @@
// Maps are Go's built-in associative data type (sometimes // Maps are Go's built-in [associative data type](http://en.wikipedia.org/wiki/Associative_array)
// called "hashes" or "dicts" in other languages). // (sometimes called _hashes_ or _dicts_ in other languages).
package main package main
import "fmt" import "fmt"
func main() { func main() {
// To create an empty map, use the builtin `make`: // To create an empty map, use the builtin `make`:
// `make(map[key-type]val-type)`. // `make(map[key-type]val-type)`.
m := make(map[string]int) m := make(map[string]int)

View File

@ -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 $ go run maps.go
map: map[k1:7 k2:13] map: map[k1:7 k2:13]
v1: 7 v1: 7