Variables
This lesson discusses how variables are used in Go.
We'll cover the following...
Introduction
A value that can be changed by a program during execution is called a variable. The general form for declaring a variable uses the keyword var as:
var identifier type
Here, identifier
is the name of the variable, and type
is the type of the variable. As discussed earlier in this chapter, type
is written after the identifier
of the variable, contrary to most older programming languages. When a variable is declared, memory in Go is initialized, which means it contains the default zero or null value depending upon its type ...