github.com/traefik/yaegi@v0.15.1/_test/method9.go (about) 1 package main 2 3 type Coord struct { 4 x, y int 5 } 6 7 func main() { 8 o := Coord{3, 4} 9 println(o.dist()) 10 } 11 12 func (c Coord) dist() int { return c.x*c.x + c.y*c.y } 13 14 // Output: 15 // 25