'init'
This commit is contained in:
26
demo/demo01.go
Normal file
26
demo/demo01.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var a int = 100
|
||||
var b int = 30
|
||||
c := sum(a, b)
|
||||
fmt.Println(c)
|
||||
test(32, 54)
|
||||
|
||||
}
|
||||
|
||||
// 函数的首字母大写可以被其他包的文件访问(类似于public)
|
||||
// 函数的首字母小写只能被本包访问(类似于private)
|
||||
func sum(a int, b int) int {
|
||||
return a + b
|
||||
}
|
||||
func test(args ...int) {
|
||||
for i := 0; i < len(args); i++ {
|
||||
fmt.Println(args[i])
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user