A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-125.go
1packagemain
2
3import"fmt"
4
5funcmain(){
6m:=map[string]int{"a":0}
7v:=m["a"]
8_,ok:=m["a"]
9fmt.Println(v==0,ok)
10}
Maps
Answer & explanation
Console output
true true
Why
A single-value index returns just the value (0 here), so v == 0 is true. The comma-ok index additionally reports presence; since "a" is stored, ok is true. The point: a true value-is-zero does not imply the key is missing. You need ok to know.