golang-exercises/tour-of-go/methods-2/main.go

19 lines
194 B
Go

package main
import (
"fmt"
)
type Nums struct {
X float64
}
func (n Nums) Multiply() float64 {
return n.X * 2
}
func main() {
newnumber := Nums{10}
fmt.Println(newnumber.Multiply())
}