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)
}

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

posted @ 2014-10-26 19:53  wuhn  阅读(114)  评论(0编辑  收藏  举报