Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Package variable

package main

import (
	"fmt"
)

var y int

func main() {
	showY()
	setY()
	showY()
}

func setY() {
	y = 42
}
func showY() {
	fmt.Println(y)
}
0
42