Every programming language in this world provides options to declare and define variables and used by parts of the program. So Go does the same. The wiki states that a variable is a symbolic name associated with a value and whose associated value may be changed But in more technical way, a variable is a memory location with name which might hold values and may change later. Variables in memory Go provides different options to declare and define the variables. Let's see how we can declare variable in Golang. Variable declaration A variable in go could be declared as follows, package main import "fmt" var a = "has some value" func main() { fmt.Println(a) } Here the variable a is declared and initialized with the value "has some value" . The type of the variable is inferred from the value been assigned. Supported Types in Golang Go supports the following primitive types Base Types Description Numerics
A blog about web and distributed systems