Function literals in Go
We don’t need to assign a name to functions in Go. Functions can be written as literals. This is called function literal
:
1function := func(a, b float64) float64 {
2 return math.Pow(a, b)
3}
References
- John Arundel, For the Love of Go
Next -> closures-in-go
#variadic #values #list #signature #type #golang #first_class_citizens #body #parameters #declare #programming #expression #tuple #functions #literals