Ints in Go

Posted by GoDoc
Public (Editable by Users)

Ints sorts a slice of ints in increasing order.

Go
Edit
package main

import (
	"fmt"
	"sort"
)

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