package main

import "fmt"

// section: constraint
type Numeric interface {
	int | int32 | int64 | float32 | float64
}

// section: constraint

// section: function
func Add[T Numeric](a, b T) T {
	return a + b
}

func Multiply[T Numeric](a, b T) T {
	return a * b
}

// section: function

func main() {
	// Works with various numeric types
	fmt.Println("Int addition:", Add(5, 3))
	fmt.Println("Float addition:", Add(3.14, 2.86))
	fmt.Println("Int multiplication:", Multiply(4, 7))
	fmt.Println("Float multiplication:", Multiply(2.5, 1.5))
}
