Declaring Variables in Go

Go as a statically typed language requires the developer to set the type of a variable when declaring one. var age int Declaring a variable means allocating some space in memory to store some value of a given type. In Go you start with the keyword var followed by the name and its type. In the example above the variable age was given an integer type int but was not initialized explicitly....

March 1, 2024 · 3 min