--
--
官网: http://golang-china.org/
IRC: irc.freenode.net #golang-china
@golangchina
---
您收到此邮件是因为您订阅了 Google 网上论坛的“Golang-China”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 golang-china...@googlegroups.com。
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
// map
package main
import (
"fmt"
)
type Vertex struct {
Lat, Long float64
}
var m map[string]Vertex
var m2 map[string]Vertex{
"Bell Labs": {
40.68433, -74.39967,
},
"Google": {
37.42202, -122.08408,
},
}
func main() {
m = make(map[string]Vertex)
m["Bell Labs"] = Vertex{
40.68433, 74.39967,
}
fmt.Println(m["Bell Labs"])
fmt.Println(m2)
}
D:/go/bin/go.exe build [D:/GoStudy/map]
# _/D_/GoStudy/map
.\map.go:14: syntax error: unexpected { at end of statement
错误: 进程退出代码 2.
m2 的定义哪里有错啊,为什么编译报错?
ok,小白 明白了,谢谢!