A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-154.go
1packagemain
2
3import"fmt"
4
5funcf()(sstring){
6deferfunc(){s+="!"}()
7s="hi"
8return
9}
10
11funcmain(){
12fmt.Println(f())
13}
Defer
Answer & explanation
Console output
hi!
Why
A bare return on a named result returns the current value of s, which is "hi". Then the deferred closure runs s += "!", appending to the same named variable, so the caller receives "hi!". The defer mutates the result after the return statement.