Quidest?

Functions as values in Go

· Lorenzo Drumond

In Go, functions are values. We can do anything with a function that we could do with a value; we can:

To declare a variable with a function type, we can write:

1var function func(float64, float64) float64

We’ve declared a variable named function whose type is func(float64, float64) float64

References

Next -> function-literals-in-go

#variadic #values #list #signature #type #golang #first_class_citizens #body #parameters #programming #expression #tuple #functions #declare