Built-in function

Go min()

Returns the least of one or more ordered arguments. It accepts individual arguments, not slice expansion. Strings compare by bytes; floating-point NaN propagates and negative zero wins over positive zero. Example prints 4. Requires Go 1.21.

Formal Syntax & Structure

go syntaxgo
min(x, y, ...)

Parameters & Attributes

NameTypeDescription
xordered valueFirst candidate.
otherscompatible ordered valuesAdditional candidates.

Return Value

common argument type or untyped constant

Least argument value.

Working Example

Example Snippetgo
package main
import "fmt"
func main() {  fmt.Println(min(4, 11, 7))}
Go Reference