A Tour of Go Variables with initializers

时间:2023-03-09 02:04:11
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 = ,
var c, python, java = true, false, "no!" func main() {
fmt.Println(i, j, c, python, java)
}