← Back to archive

Stdle #73 · defer · 2026-08-18

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) {
defer func() {
r := recover()
fmt.Println("got:", r)
n = 0
}()
panic(42)
}
func main() {
fmt.Println(f())
}
Defer
2 lines
4 attempts left

Answer & explanation