Stdle #33 · interfaces · 2026-07-09
What does this Go snippet output?
A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
package main import "fmt" type Shape interface{ Area() float64 }type Sq struct{ s float64 } func (q Sq) Area() float64 { return q.s * q.s } func main() { var sh Shape = Sq{3} fmt.Println(sh.Area())}Interfaces