Google News
logo
Golang - Interview Questions
Can you return multiple values from a function?
Yes. A Go function can return multiple values, each separated by commas in the return statement.
package main

import "fmt"

func foo() (string, string) {
   return "two", "values"
}

func main() {
   fmt.Println(foo())

}​
Output : 
two values
Advertisement