package main

import (
	"fmt"

	"golang.org/x/exp/constraints"
)

// section: basic
// Max returns the maximum of two values
func Max[T constraints.Ordered](a, b T) T {
	if a > b {
		return a
	}
	return b
}

func main() {
	// Type inference works here - Go knows we want Max[int]
	result1 := Max(5, 8)
	fmt.Printf("Max(5, 8) = %d\n", result1)

	// Type instantiation - we explicitly specify the type
	result2 := Max[int](5, 8)
	fmt.Printf("Max[int](5, 8) = %d\n", result2)

	// Both calls do the same thing, but the second is explicit
}

// section: basic
