Get the App
SLTechnology News&Howtos  ›  Development  › 

The grammatical structure of functions in golang

Shulou Source: shulou.com Published: 2022-06-02 08:24:53 10月03日 Update

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!

Tags: Function parameter content variable structure syntax copy pointer more user article good practical indifferent key keyword function address local form Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux vpn Microsoft Huawei macOS