Introduction
In Go, functions can return multiple values. This feature is commonly used to return both a result and an error value from a function.
This tutorial is from open-source community. Access the source code
In Go, functions can return multiple values. This feature is commonly used to return both a result and an error value from a function.
Complete the swap
function to return two input parameters in reverse order.
swap
function should take two integers as input parameters.swap
function should return two integers in reverse order.$ go run multiple-return-values.go
3
7
7
## Accepting a variable number of arguments is another nice
## feature of Go functions; we'll look at this next.
In this challenge, you learned how to use multiple return values in Go. By completing the swap
function, you were able to swap two integers and return them in reverse order.