A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-146.go
1packagemain
2
3import"fmt"
4
5typePtstruct{X,Yint}
6
7funcmain(){
8a:=Pt{1,2}
9b:=Pt{2,1}
10fmt.Println(a==b)
11}
Classes
Answer & explanation
Console output
false
Why
Struct equality compares corresponding fields, not a bag of values. a has X=1,Y=2 while b has X=2,Y=1, so the X fields already differ and a == b is false. The same numbers in different fields do not make structs equal.