shad-go/lectures/08-generics/min/generic/min.go

11 lines
138 B
Go
Raw Normal View History

2022-04-07 15:04:16 +00:00
package generic
import "golang.org/x/exp/constraints"
func min[T constraints.Ordered](x, y T) T {
if x < y {
return x
}
return y
}