Sign in
go
/
playground
/
972afd6b3ff8f6b36c8bbbd6cf31498b665af357
/
.
/
examples
/
min.gotip.txt
blob: 3c719788ea5524e18a2eb875eee183f396fe4099 [
file
] [
log
] [
blame
]
// Title: Generic min
package main
import (
"fmt"
"constraints"
)
func min[P constraints.Ordered](x, y P) P {
if x < y {
return x
} else {
return y
}
}
func main() {
fmt.Println(min(42, 24))
}