Standard library / sort

sort.IntSlice

Named slice adapter implementing sort.Interface; conversion shares existing backing storage. Expected stdout: '[1 2 3]\n'.

Formal Syntax & Structure

go syntaxgo
type IntSlice []int

Working Example

Example Snippetgo
package main
import (  "fmt"  "sort")
func main() {  a := sort.IntSlice([]int{3, 1, 2})  sort.Sort(a)  fmt.Println(a)}
Go Reference