Skip to content

Instantly share code, notes, and snippets.

@na-o-ys
Last active August 29, 2015 14:01
Show Gist options
  • Save na-o-ys/65553f069e341ec807b0 to your computer and use it in GitHub Desktop.
Save na-o-ys/65553f069e341ec807b0 to your computer and use it in GitHub Desktop.
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())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment