当前位置:网站首页>Rules for using init in golang
Rules for using init in golang
2022-07-04 09:16:00 【The diligent bird that flies first】
package main
import "fmt"
var age = test()
func test() int{
fmt.Println("test")
return 90
}
func init(){
fmt.Println("init start")
}
func main(){
fmt.Println("main start")
}
The results of the implementation are as follows
test
init start
main start
- Execute global variable
- perform init function , As long as it is used for initialization of global variables
- perform main function
边栏推荐
- Trim leading or trailing characters from strings- Trim leading or trailing characters from a string?
- Global and Chinese trisodium bicarbonate operation mode and future development forecast report Ⓢ 2022 ~ 2027
- 《网络是怎么样连接的》读书笔记 - WEB服务端请求和响应(四)
- 《网络是怎么样连接的》读书笔记 - Tcp/IP连接(二)
- 2022-2028 global optical transparency industry research and trend analysis report
- How to write unit test cases
- awk从入门到入土(7)条件语句
- 什么是uid?什么是Auth?什么是验证器?
- What is uid? What is auth? What is a verifier?
- Some points needing attention in PMP learning
猜你喜欢

【LeetCode 42】501. Mode in binary search tree

AI Winter Olympics | is the future coming? Enter the entrance of the meta universe - virtual digital human

2022-2028 global gasket metal plate heat exchanger industry research and trend analysis report

2022-2028 global industry research and trend analysis report on anterior segment and fundus OTC detectors

Educational Codeforces Round 119 (Rated for Div. 2)

Codeforces Round #793 (Div. 2)(A-D)

2022-2028 global intelligent interactive tablet industry research and trend analysis report

At the age of 30, I changed to Hongmeng with a high salary because I did these three things

随机事件的关系与运算
![C language - Introduction - Foundation - syntax - [variable, constant light, scope] (V)](/img/dc/5c8077c10cdc7ad6e6f92dedfbe797.png)
C language - Introduction - Foundation - syntax - [variable, constant light, scope] (V)
随机推荐
上周热点回顾(6.27-7.3)
How to write unit test cases
Reload CUDA and cudnn (for tensorflow and pytorch) [personal sorting summary]
Sequence model
How do microservices aggregate API documents? This wave of show~
China electronic grade sulfur trioxide Market Forecast and investment strategy report (2022 Edition)
地平线 旭日X3 PI (一)首次开机细节
What is uid? What is auth? What is a verifier?
In depth investigation and Strategic Research Report on China's motion controller Market (2022 Edition)
What exactly is DAAS data as a service? Don't be misled by other DAAS concepts
AMLOGIC gsensor debugging
Codeforces Round #803 (Div. 2)(A-D)
【LeetCode 42】501. Mode in binary search tree
DR6018-CP01-wifi6-Qualcomm-IPQ6010-IPQ6018-FAMILY-2T2R-2.5G-ETH-port-CP01-802-11AX-MU-MIMO-OFDMA
If you can quickly generate a dictionary from two lists
Awk from getting started to digging in (11) detailed explanation of awk getline function
2022-2028 global elastic strain sensor industry research and trend analysis report
Educational Codeforces Round 119 (Rated for Div. 2)
Sword finger offer 30 contains the stack of Min function
UML sequence diagram [easy to understand]