In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use the formal parameters of Go". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use the formal parameters of Go".
Formal parameter
Formal arguments are used as local variables of the function. Examples are as follows:
Example
Package main
Import "fmt"
/ * declare global variables * /
Var an int = 20
Func main () {
/ * declare a local variable in the main function * /
Var an int = 10
Var b int = 20
Var c int = 0
Fmt.Printf (a =% d\ n in the "main () function, a)
C = sum (a, b)
Fmt.Printf ("main () function c =% d\ n", c)
}
/ * function definition-add two numbers * /
Func sum (a, b int) int {
Fmt.Printf (a =% d\ n in the "sum () function, a)
Fmt.Printf ("sum () function b =% d\ n", b)
Return a + b
}
The output of the above example is as follows:
Main () function a = 10sum () function a = 10sum () function b = 20main () function c = 30 thank you for reading, the above is "how to use the formal parameters of Go" content, after the study of this article, I believe that you have a deeper understanding of how to use the formal parameters of Go, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.