A Tour of Go Function values
Functions are values too.
在函数式语言中中函数都是变量,比如在javascript中
package main import ( "fmt" "math" ) func main() { hypot := func(x,y float64) float64 { return math.Sqrt(x*x + y*y) } fmt.Println(hypot(3, 4)) }
Functions are values too.
在函数式语言中中函数都是变量,比如在javascript中
package main import ( "fmt" "math" ) func main() { hypot := func(x,y float64) float64 { return math.Sqrt(x*x + y*y) } fmt.Println(hypot(3, 4)) }