← Back to archive

Stdle #41 · defer · 2026-07-17

What does this Go snippet output?

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

package main
import "fmt"
func main() {
x := 1
defer func() { fmt.Println(x) }()
x = 42
}
Defer
4 attempts left

Answer & explanation