← Back to archive

Stdle #154 · defer · 2026-11-07

What does this Go snippet output?

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

package main
import "fmt"
func f() (s string) {
defer func() { s += "!" }()
s = "hi"
return
}
func main() {
fmt.Println(f())
}
Defer
4 attempts left

Answer & explanation