← Back to archive

Stdle #23 · defer · 2026-06-29

What does this Go snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

package main
import "fmt"
func main() {
a := []int{1, 2, 3}
defer func() { fmt.Println(a) }()
a = append(a, 4)
a[0] = 99
}
Defer
4 attempts left

Answer & explanation