Sign in
go
/
website
/
9817d4fb13305c1bd5e5a0f41e8fe3f582406a39
/
.
/
_content
/
tour
/
methods
/
methods.go
blob: 692a095101e4eee70930530abd0bee1f3efab118 [
file
] [
log
] [
blame
]
// +build OMIT
package main
import (
"fmt"
"math"
)
type Vertex struct {
X, Y float64
}
func (v Vertex) Abs() float64 {
return math.Sqrt(v.X*v.X + v.Y*v.Y)
}
func main() {
v := Vertex{3, 4}
fmt.Println(v.Abs())
}