Variables
Variable Declaration in Go
Used to declare a variable.
Syntax
//long hand assignment
var variableName dataType
dataType = value
//short hand assignment, inferring type
variable := value
Notes
Inferred variables are automatically assigned to a primitive data type.
Example
package main
func main() {
var year int
year = 2016
name := "Anthony"
}
See Also
RelatedDocumentation
The Go Programming Language Specification - The Go Programming Language