Standard library / sort
sort.Ints()
Sorts the slice ascending in place; no stability guarantee. Expected stdout: '[1 2 3]\n'.
Formal Syntax & Structure
go syntaxgo
func Ints(x []int)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | []int | Input value or collection to process. |
Working Example
Example Snippetgo
package main
import ( "fmt" "sort")
func main() { a := []int{3, 1, 2} sort.Ints(a) fmt.Println(a)}