A Tour of Go Maps
2014-10-27 22:51
295 查看
A map maps keys to values.
Maps must be created with
Maps must be created with
make(not
new) before use; the
nilmap 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"]) }
相关文章推荐
- A Tour of Go : Exercise: Maps
- A Tour of Go Mutating Maps
- A Tour of Go Exercise: Maps
- 【GoLang笔记】A Tour of Go - Exercise: Equivalent Binary Trees
- A Tour of Go Numeric Constants
- A Tour of Go Slicing slices
- A Tour of Go Buffered Channels
- A Tour of Go:开始!
- 【GoLang笔记】A Tour of Go - Exercise: Images
- A Tour of Go Making slices
- A Tour of Go Interfaces
- A Tour of Go---Exercise: Fibonacci closure
- The Tour of Go(1) - 从零开始搭建Go开发环境
- 【Go语言(golang)教程】A Tour of Go 七十集大全
- A Tour of Go Nil slices
- A Tour of Go Errors
- A Tour of Go : Exercise: Loops and Functions
- A Tour of Go Map literals
- A Tour of Go: Exercise: Rot13 Reader
- A Tour of Go Range