Function semantics

Forwarding multiple results

When a call supplies all its arguments through one multi-result call, the produced values can fill corresponding parameters if the types match. Mixing other arguments with that result list is invalid. Example output: '4 ready'.

Formal Syntax & Structure

go syntaxgo
g(f())

Working Example

Example Snippetgo
package main
import "fmt"
func pair() (int, string) { return 4, "ready" }func main() {  fmt.Println(pair())}
Go Reference