Standard library / sort
sort.Float64Slice.Less()
Reports whether the element at i precedes the element at j. Indices must be valid. Floating-point NaNs precede all other values. Expected stdout: 'true false\n'.
Formal Syntax & Structure
go syntaxgo
func (x Float64Slice) Less(i, j int) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| i | int | Index or start position. |
| j | int | Second index or exclusive end position. |
Return Value
bool
Reports whether the element at i precedes the element at j. Indices must be valid. Floating-point NaNs precede all other values.
Working Example
Example Snippetgo
package main
import ( "fmt" "sort")
func main() { a := sort.Float64Slice([]float64{1.5, 2.5, 3.5}) fmt.Println(a.Less(0, 1), a.Less(1, 0))}