A Tour of Go Variables with initializers

A var declaration can include initializers, one per variable.

If an initializer is present, the type can be omitted; the variable will take the type of the initializer.

package main 

import "fmt"

var i, j int = 1,3
var c, python, java = true, false, "no!"

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

 

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