WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Go - functions as values


Go programming language offers the power to create features at the fly and use them as values.

bundle primary

import (
   "fmt" 
   "math" 
)

func foremost()
   /* declare a feature variable */
   getSquareRoot := func(x float64) float64 
      return math.Sqrt(x)
   

   /* use the function */
   fmt.Println(getSquareRoot(21))

When the above code is compiled and completed, it produces the following result
$cross run principal.Move
four.58257569495584