go-learn/multiple-returns.go

30 lines
344 B
Go
Raw Normal View History

2021-03-04 16:57:36 +00:00
package main
import (
"fmt"
"strings"
)
func vals() (int, int) {
return 3, 7
}
func strs(a string) (string, string, string) {
b := strings.Split(a, " ")
return b[0], b[1], b[2]
}
func main() {
a, b := vals()
fmt.Println(a)
fmt.Println(b)
_, c := vals()
fmt.Println(c)
x, y, z := strs("One Two Three")
fmt.Println(x, y, z)
}