, Variables , Variables point to a memory location which stores some kind of value. The type parameter(in the below syntax) represents the type of value that can be stored in the memory location. , , Variable can be declared using the syntax , , var , Once You declare a variable of a type You can assign the variable to any value of that type. , , You can also give an initial value to a variable during the declaration itself using , , var = , If You declare the variable with an initial value, Go an infer the type of the variable from the type of value assigned. So You can omit the type during the declaration using the syntax , , var = , Also, You can declare multiple variables with the syntax , , var , = , , The below program in this Go tutorial has some Golang examples of variable declarations , , , package main , import DQfmtDQ , , func main() { , //declaring a integer variable x , var x int , x=3 //assigning x the value 3 , fmt.Println(DQx:DQ, x) //prints 3 , , //declaring a integer variable y with value 20 in a single statement and prints it , var y int=20 , fmt.Println(DQy:DQ, y) , , //declaring a variable z with value 50 and prints it , //Here type int is not explicitly mentioned , var z=50 , fmt.Println(DQz:DQ, z) , , //Multiple variables are assigned in single line- i with an integer and j with a string , var i, j = 100,DQhelloDQ , fmt.Println(DQi and j:DQ, i,j) , } , The output will be , , , x: 3 , y: 20 , z: 50 , i and j: 100 hello , Go Language also provides an easy way of declaring the variables with value by omitting the var keyword using , , := , Note that You used := instead of =. You cannot use := just to assign a value to a variable which is already declared. := is used to declare and assign value. , , Create a file called assign.go with the following code , , package main , import (DQfmtDQ) , , func main() { , a := 20 , fmt.Println(a) , , //gives error since a is already declared , a := 30 , fmt.Println(a) , } , Execute go run assign.go to see the result as , , ./assign.go:7:4: no new variables on left side of := , Variables declared without an initial value will have of 0 for numeric types, false for Boolean and empty string for strings ,