Posted on 4th August 2020|12 views
How to return multiple values in Golang?
Posted on 24th October 2025| views
You can do it this way
package main
import "fmt"
func vals() (int, int){
return 6, 7
}
func main()
{
x, y := vals()
fmt.println(x)
fmt.println(y)
_, z := vals()
fmt.println(z)
}
Output:
6
7
7