A Tour of Go Variables

The var statement declares a list of variables; as in function argument lists, the type is last.

package main 

import "fmt"

var i int
var c, python, java bool

func main() {
    fmt.Println(i, c, python, java)
}

 类型是必须的,否则会报错

原文地址:https://www.cnblogs.com/ghgyj/p/4052615.html