← Back to archive

Stdle #113 · maps · 2026-09-27

What does this Go snippet output?

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

package main
import "fmt"
func main() {
var m map[string]int
defer func() {
fmt.Println("err:", recover() != nil)
}()
delete(m, "k")
fmt.Println("deleted ok")
m["k"] = 1
}
Maps
2 lines
4 attempts left

Answer & explanation