A Tour of Go Maps

A map maps keys to values.

Maps must be created with make (not new) before use; the nil map is empty and cannot be assigned to.

package main 

import "fmt"

type Vertex struct{
Lat, Long float64
} var m map[string]Vertex func main() {
m = make(map[string]Vertex)
m["Bell Labs"] = Vertex{
40.68433, -74.39967,
}
fmt.Println(m["Bell Labs"])
}
上一篇:Eclipse 项目导入 Studio Debug运行卡死在进入界面


下一篇:diff/merge configuration in Team Foundation - common Command and Argument values - MSDN Blogs