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

Defer and slice

package main

import "fmt"

func main() {
	words := []string{"zero", "one", "two"}
	defer say(words)
	words[0] = "END"
}

func say(text []string) {
	fmt.Println(text)
}