Reverse in Go

Posted by GoDoc
Public (Editable by Users)

Reverse returns the reverse order for data.

Go
Edit
package main

import (
	"fmt"
	"sort"
)

func main() {
	s := []int{5, 2, 6, 3, 1, 4} // unsorted
	sort.Sort(sort.Reverse(sort.IntSlice(s)))
	fmt.Println(s)
}