Skip to content

Instantly share code, notes, and snippets.

@jochasinga jochasinga/swap.go
Created Sep 30, 2014

What would you like to do?
Multiple return values in Go
package main
import "fmt"
func swap(a, b int) (int, int) {
_a := a
_b := b
a, b = _b, _a
return a, b
func main() {
fmt.Println(swap(1, 5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.