multipleres.go 284 B

1234567891011121314151617
  1. // Functions can return multiple results
  2. package examples
  3. import "fmt"
  4. // This function returns two strings
  5. func swap(x, y string) (string, string) {
  6. return y, x
  7. }
  8. func Multipleres() (string, string) {
  9. a, b := swap(" Language!", "Go")
  10. fmt.Printf("%s%s\n", a, b)
  11. return a, b
  12. }