Standard library / sort

sort.Float64Slice

Named slice adapter implementing sort.Interface; conversion shares existing backing storage. Floating-point NaNs precede all other values. Expected stdout: '[1.5 2.5 3.5]\n'.

Formal Syntax & Structure

go syntaxgo
type Float64Slice []float64

Working Example

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