Standard library / sort

sort.Float64Slice.Sort()

Sorts the receiver in ascending order in place; does not guarantee stability. Floating-point NaNs precede all other values. Expected stdout: '[1.5 2.5 3.5]\n'.

Formal Syntax & Structure

go syntaxgo
func (x Float64Slice) Sort()

Working Example

Example Snippetgo
package main
import (  "fmt"  "sort")
func main() {  a := sort.Float64Slice([]float64{3.5, 1.5, 2.5})  a.Sort()  fmt.Println(a)}
Go Reference