Go 多值函数和string练手

来源:互联网 发布:windows 输出到文件 编辑:程序博客网 时间:2024/05/16 08:12

       上班之前练练手:

package mainimport "fmt"func main(){    x := "hello"    y := "world"    a, b := swap(x, y)    fmt.Println(a, b)}func swap(a, b string) (string, string){    return b, a}
      结果:

world hello

原创粉丝点击