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

Constants cannot be changed

package main

import (
	"fmt"
)

const pi float32 = 3.14

func main() {
	fmt.Println(pi)
	pi = 23.14
}
# command-line-arguments
./const_protection.go:11:5: cannot assign to pi