golang 缺少逗号报错问题

  一个逗号引发的语法报错问题:syntax error: unexpected newline, expecting comma or }或者missing ',' before newline in composite literal

  代码如下:

  

func main() {
boxes := Boxlist{
Box{4, 4, 4, RED},
Box{5, 5, 5, YELLOW},
Box{6, 6, 6, BLACK},
Box{10, 10, 10, BLUE},
Box{8, 8, 8, WHITE}, // 此处逗号不可省略 115:19: missing ',' before newline in composite literal
} func main() {
a := map[string]int{
"golang": 2,
"python": 1,
"java": 3, // syntax error: unexpected newline, expecting comma or }
}
Println(a)
}

  

上一篇:关于ASP.net TextBox控件的失去焦点后触发其它事件


下一篇:由对象到原型