Stats

166 Contributors: 3
2017-03-10
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

Variables

Download go eBook

Syntax

  • var x int // declare variable x with type int
  • var s string // declare variable s with type string
  • x = 4 // define x value
  • s = "foo" // define s value
  • y := 5 // declare and define y inferring its type to int
  • f := 4.5 // declare and define f inferring its type to float64
  • b := "bar" // declare and define b inferring its type to string

Related Examples