A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-173.go
1packagemain
2
3import"fmt"
4
5typeTstruct{Nint}
6
7funcmain(){
8orig:=T{N:3}
9copy:=orig
10copy.N++
11fmt.Println(orig.N,copy.N)
12}
Classes
Answer & explanation
Console output
3 4
Why
Assigning a struct value copies it field by field, so copy is independent of orig. Incrementing copy.N affects only copy, leaving orig.N at 3 and making copy.N 4. (The local variable named copy shadows the builtin copy here, which is harmless since it is not called.)