A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-12.go
1packagemain
2
3import"fmt"
4
5funcmain(){
6cfg:=struct{
7Debugbool
8Levelint
9}{}
10fmt.Println(cfg.Debug,cfg.Level)
11}
Classes
Answer & explanation
Console output
false 0
Why
The empty composite literal {} constructs the zero value of the anonymous struct type, setting each field to its zero. Debug becomes false (bool’s zero) and Level becomes 0 (int’s zero). Anonymous structs obey the same zero-value rules as named structs.