package main
import (
"fmt"
"math"
)
func main() {
getSquareRoot := func(x float64) float64 { //等价于func getSquareRoot1(x float64) float64{}
return math.Sqrt(x)
}
fmt.Println(getSquareRoot(9))
fmt.Println(getSquareRoot1(16))
}
func getSquareRoot1(x float64) float64 {
return math.Sqrt(x)
}
网友评论