Last active
August 29, 2015 14:15
-
-
Save haileys/13901d5e92cd4502c2ab to your computer and use it in GitHub Desktop.
This file contains hidden or 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
func Reverse<T>(slice []T) { | |
for i := 0; i < len(slice) / 2; i++ { | |
j := len(slice) - i - 1 | |
x := slice[j] | |
slice[j] = slice[i] | |
slice[i] = x | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment