Scope and initialization
Package and file scope
Top-level variable, constant, type and ordinary function names belong to package scope. Imports are file-scoped. Predeclared names belong to the universe block. Example output: '3'.
Formal Syntax & Structure
go syntaxgo
package name; import "path"Working Example
Example Snippetgo
package main
import "fmt"
var total = 3
func main() { fmt.Println(total)}