A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-126.go
1packagemain
2
3import"fmt"
4
5typePtstruct{X,Yint}
6
7funcmain(){
8a:=Pt{1,2}
9b:=Pt{1,2}
10fmt.Println(a==b)
11}
Classes
Answer & explanation
Console output
true
Why
Structs whose fields are all comparable can be compared with ==, which checks every field for equality rather than checking identity. a and b hold the same field values (X=1, Y=2), so a == b is true even though they are distinct variables.