In Go, top-level variable assignments must be prefixed with the var keyword. Omitting the varkeyword is only allowed within blocks.
package main
var toplevel = "Hello world" // var keyword is required
func F() {
withinBlock := "Hello world" // var keyword is not required
}

548

被折叠的 条评论
为什么被折叠?



