← Back to archive

Stdle #99 · defer · 2026-09-13

What does this Go snippet output?

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

package main
import "fmt"
func f() (n int) {
n = 1
defer func() { n++ }()
defer func() { n *= 10 }()
return n
}
func main() {
fmt.Println(f())
}
Defer
4 attempts left

Answer & explanation