Skip to content

Instantly share code, notes, and snippets.

@haileys
Last active August 29, 2015 14:15
Show Gist options
  • Save haileys/13901d5e92cd4502c2ab to your computer and use it in GitHub Desktop.
Save haileys/13901d5e92cd4502c2ab to your computer and use it in GitHub Desktop.
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