maps
This commit is contained in:
parent
d75280c111
commit
0e16b3c8a6
@ -8,7 +8,7 @@ Hello World
|
||||
# Switch
|
||||
# Arrays
|
||||
# Slices
|
||||
# Maps
|
||||
Maps
|
||||
# Range
|
||||
# Functions
|
||||
# Multiple Return Values
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user