The grammatical structure of functions in golang
This article is about the grammatical structure of functions in golang. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The function contains: func Testfunc (parameter-list) return-list {
Function body
}
What is defined after the keyword func convention is the function, which has input parameters, and return parameters, as well as the function body that implements a specific function; where the input parameters and return parameters can be all or partially empty. Input parameters are generally called formal parameters, but they actually pass a copy of the caller's parameters, except for pointers, because the copied pointers also point to the same address.
Because the variables inside the function are local variables, it doesn't matter what variables are returned to the function caller, and doesn't care.
Thank you for reading! This is the end of this article on "the grammatical structure of functions in golang". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!