美文网首页Go
Go method 02

Go method 02

作者: JaedenKil | 来源:发表于2019-03-04 14:59 被阅读0次
package main

import "fmt"

func main() {
    a, b := swap("hello", "world")
    fmt.Println(a, b)
    var x = "hello"
    var y = "golang"
    fmt.Print(swap(x, y))
}

func swap(x string, y string) (string, string) {
    return y, x
}

Outputs:

world hello
golanghello

相关文章

网友评论

    本文标题:Go method 02

    本文链接:https://www.haomeiwen.com/subject/emliuqtx.html