← Back to archive

Stdle #128 · defer · 2026-10-12

What does this Go snippet output?

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

package main
import "fmt"
func main() {
x := 10
defer func(v int) { fmt.Println(v) }(x)
x = 20
}
Defer
4 attempts left

Answer & explanation