← Back to archive

Stdle #107 · defer · 2026-09-21

What does this Go snippet output?

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

package main
import "fmt"
func main() {
n := 0
defer func() { fmt.Println(n) }()
defer func() { n += 5 }()
defer func() { n += 3 }()
n = 1
}
Defer
4 attempts left

Answer & explanation