()
| 10 | ) |
| 11 | |
| 12 | func main() { |
| 13 | |
| 14 | // Sorting functions are generic, and work for any |
| 15 | // _ordered_ built-in type. For a list of ordered |
| 16 | // types, see [cmp.Ordered](https://pkg.go.dev/cmp#Ordered). |
| 17 | strs := []string{"c", "a", "b"} |
| 18 | slices.Sort(strs) |
| 19 | fmt.Println("Strings:", strs) |
| 20 | |
| 21 | // An example of sorting `int`s. |
| 22 | ints := []int{7, 2, 4} |
| 23 | slices.Sort(ints) |
| 24 | fmt.Println("Ints: ", ints) |
| 25 | |
| 26 | // We can also use the `slices` package to check if |
| 27 | // a slice is already in sorted order. |
| 28 | s := slices.IsSorted(ints) |
| 29 | fmt.Println("Sorted: ", s) |
| 30 | } |
nothing calls this directly
no outgoing calls
no test coverage detected