package learning import ( "fmt" "math" ) type MethodsVertex struct { X, Y float64 } func (v MethodsVertex) Abs() float64 { return math.Sqrt(v.X*v.X + v.Y*v.Y) } func MethodsLearning() { v := MethodsVertex{3, 5} fmt.Println(v.Abs()) } func (v MethodsVertex) Scale(f float64) { v.X = v.X * f v.Y = v.Y * f } func PointersMethodsLearning() { v := MethodsVertex{3,4} v.Scale(10) fmt.Println(v.Abs()) }