Go method 02

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)