Categorygithub.com/fakorede/learning-golanggo-functions03-function-and-method-expressions02-returning-functions-from-functions
package
0.0.0-20200526015148-b343531734ec
Repository: https://github.com/fakorede/learning-golang.git
Documentation: pkg.go.dev
# README
Returning Functions From Functions
func main() {
add := mathExpression()
fmt.Println(add(5.0, 15.0))
}
func mathExpression() func(float64, float64) float64 {
return func(f1 float64, f2 float64) float64 {
return f1 + f2
}
}
mathExpression
returns a function which takes in 2 float64's and returns a float64.