The result of the above code execution is: Go language has the flexibility to create functions and use them as arguments to another function. In the following example, we initialize a variable in a defined function just to use the built-in function math.sqrt() , an example is: 2.13.1. Example #
package main import ( "fmt" "math" ) func main(){ /* Declare function variables */ getSquareRoot := func(x float64) float64 { return math.Sqrt(x) } /* Using functions */ fmt.Println(getSquareRoot(9)) }
3