underscore
GitHubToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Max

Max returns the maximum value in the slice. This function can currently only compare numbers reliably. This function uses operator <.

package main

import (
	"fmt"
	u "github.com/rjNemo/underscore"
)

func main() {
	nums := []int{1, 9, 2, 8, 3, 7, 4, 6, 5}
	fmt.Println(u.Max(nums)) // 9
}