3. Variables in Go — A Book of Go

Louis Petrik
2 min readMay 14, 2024
Source: the author

Now, let’s talk about variables.

Variables can be declared with the keyword var:

  • Can be a list of variables: `var a, b, c int
  • Can be used within functions (used at package or function level)
  • A vardeclaration can have an initialisation: var i int = 1

--

--