Files
go-study/main/project.go
2024-08-01 23:40:06 +08:00

23 lines
325 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package main
import "fmt" //导入别的包 先执行别的包里面 再执行自己包里面
//做变量初始化
// 后是 init函数 全局变量再执行main函数调用
var num int = test()
func test() int {
fmt.Println("test")
return 10
}
func init() {
fmt.Println("1")
}
func main() {
fmt.Println("2")
}