package main

import (
	"fmt"
	// section: import
	"golang.org/x/exp/constraints"
	// section: import
)

// section: usage
// Using constraints.Signed for signed integers
func max[T constraints.Signed](a, b T) T {
	if a > b {
		return a
	}
	return b
}

// Using constraints.Unsigned for unsigned integers
func min[T constraints.Unsigned](a, b T) T {
	if a < b {
		return a
	}
	return b
}

// Using constraints.Float for floating point numbers
func average[T constraints.Float](numbers ...T) T {
	var sum T
	for _, num := range numbers {
		sum += num
	}
	return sum / T(len(numbers))
}

// section: usage

func main() {
	// section: usage
	fmt.Println("Max of -5 and 10:", max(-5, 10))
	fmt.Println("Min of 3 and 7:", min(uint(3), uint(7)))
	fmt.Println("Average of 1.5, 2.5, 3.5:", average(1.5, 2.5, 3.5))
	// section: usage
} 