← Back to archive

Stdle #66 · defer · 2026-08-11

What does this Go snippet output?

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

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

Answer & explanation