As long as the types match, you can pass the return values from a function directly into another function as its parameters.

For example:

func main() {
    showData(getData()) // magic!
}

func showData(a string, b int) {
    fmt.Println(a, b)
}

func getData() (string, int) {
    return "hi", 42
}
Previous on Go
Mastodon Mastodon