Created
November 9, 2014 18:25
-
-
Save akhenakh/b4dc74cbf9c576d3f6fd to your computer and use it in GitHub Desktop.
reverse a slice in Go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 { | |
res[i], res[j] = res[j], res[i] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment