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