Sign in
◑
Theme
go
/
website
/
97bcd1ead35ce4ff487a1dc339e792fb6c600b4b
/
.
/
_content
/
tour
/
methods
/
methods-continued.go
blob: be9253a46f81b905ac0c5af634d568f158976973 [
file
]
//go:build OMIT
package main
import (
"fmt"
"math"
)
type MyFloat float64
func (f MyFloat) Abs() float64 {
if f < 0 {
return float64(-f)
}
return float64(f)
}
func main() {
f := MyFloat(-math.Sqrt2)
fmt.Println(f.Abs())
}