How to check if a slice of float64 values is sorted in Go

1 Answer

0 votes
package main 
 
import ( 
    "fmt"
    "sort"
) 
   
func main() { 
    slice := []float64{2.2, 3.14, 13.455, 13.456, 19.7, 24.21} 

    fmt.Println(sort.Float64sAreSorted(slice))
} 
 
  
 
   
/*
run:
    
true

*/

 



answered Aug 17, 2020 by avibootz
...