Return multiple values in Go by listing them in parentheses and assigning them to multiple variables or ignoring extras with the blank identifier.
Go functions return multiple values by listing them in parentheses after the function name, and you capture them by assigning to multiple variables on the left side of the assignment.
func divide(a, b int) (int, int) {
return a / b, a % b
}
quotient, remainder := divide(10, 3)
If you only need one value, use the blank identifier _ to ignore the rest.
Go lets a function return several results at once, like a calculator giving you both the answer and the leftover remainder. You grab these results by listing your variable names in the same order they are returned. Think of it like a vending machine that dispenses a snack and a receipt together; you just need two hands to catch them.