Declaration of Variables

The declaration of a variable creates one or more variables, attaching identifiers corresponding to them, and assigning each one a type and an initial value.


var a, b = "value", 1.35
                        

If a list of expressions is provided, the variables are initialized with the expressions following the rules for assignment. Otherwise, each variable is initialized to its zero value.

If a type is present, each variable is assigned that type. Otherwise, each variable receives the type of the corresponding initialization value in the assignment.

variable_declaration.go