/有返回值 且返回一个func max(a int, b int) int {if a > b {return a}
return b}//有返回值 且返回二个func multi_ret(key string) (int, bool) {m := map[string]int{ "ont": 1, "two": 2, "three": 3}var err boolvar val intval, err = m[key]return val, err}//多个参数,相当于传进取一个数组
func sum(nums ...int) {fmt.Println(nums, " ")total := 0for _, num := range
golang 函数定义及其接口实例
最新推荐文章于 2022-05-02 22:13:23 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)