How can you create a multi-value return function in Go?

  • func add(x int, y int) int { return x + y }
  • func add(x int, y int) { return x, y }
  • func add(x, y int) (int, int) { return x, y }
  • func add(x, y int) int { return x + y }
In Go, you can create a multi-value return function by specifying multiple return types in the function signature, like func add(x, y int) (int, int) { return x, y }. This allows you to return multiple values from the function.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *