Go — Values, Variables, and Constants (basics)
Go has several different value types, these are:
Here are some examples:
All these values can be assigned to a variable, and saved for later use. Go’s variables are explicitly declared, the type and value are then used by the compiler to e.g. check for the correctness of types when comparing two variables, or for function calls.
Here are some examples of variables, and the initialisation of variables:
For the last part of this article i will go into: “constants”. Constants are values, when initialised, which cannot be changed. In Go you can initialise different types of constants: numeric, strings, and booleans.