Sign in
go
/
playground
/
b161c0c8529074bc9f079fa1ef4b9b1769a251d0
/
.
/
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))
}