Standard library / slices
slices.Min()
Returns the smallest ordered element; panics on empty input and propagates floating-point NaN. Expected stdout: '3\n'.
Formal Syntax & Structure
go syntaxgo
func Min[S ~[]E, E cmp.Ordered](x S) EParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | S | Input value or collection to process. |
Return Value
E
Returns the smallest ordered element; panics on empty input and propagates floating-point NaN.
Working Example
Example Snippetgo
package main
import ( "fmt" "slices")
func main() { fmt.Println(slices.Min([]int{8, 3, 5}))}