Mark McGranaghan d7bb44ff42 updates
2012-09-23 12:59:46 -07:00

24 lines
483 B
Go

// ## Multiple Return Values
// In Go, a function can return multiple values.
// This feature is used often, for example to
// return a result and an error from a function.
package main
import "fmt"
// The `(int, int)` in this signature shows that the
// function returns 2 ints.
func vals() (int, int) {
return 3, 7
}
func main() {
// Use the 2 different return values from the call.
x, y := vals()
fmt.Println(x)
fmt.Println(y)
}