Golang Tutorial

The variable x below is a local variable, it can only be used inside the main() function. package main import "fmt" func main() {x := 7 fmt.Println(x)} If you move the variable x outside of the function, it becomes a global variable. Global variables can be used by multiple functions. In this example example() and main() package main import ... ................
................