← Back to archive

Stdle #16 · interfaces · 2026-06-22

What does this Go snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

package main
import "fmt"
type Pt struct{ X, Y int }
func (p Pt) String() string {
return fmt.Sprintf("(%d,%d)", p.X, p.Y)
}
func main() {
fmt.Println(Pt{1, 2})
}
Interfaces
4 attempts left

Answer & explanation