Variables

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

A var statement can be at package or function level. We see both in this example.

variables.go

  1. package main
  2. import "fmt"
  3. var c, python, java bool
  4. func main() {
  5. var i int
  6. fmt.Println(i, c, python, java)
  7. }