func
The func keyword defines a function.
Syntax
func add(a int, b int) int {
return a + b
}
Parameter and return annotations default to int when omitted:
func add(a, b) {
return a + b
}
A function must be defined before it is called. Its name is not available inside its own definition, so direct recursion is not supported in 0.2.
See Functions for calls, returns, and name-resolution rules.