package main

import "fmt"

// section: constraint
type Number interface {
	int | float64
}

func Add[T Number](a, b T) T {
	return a + b
}

// section: constraint

// section: violation
func main() {
	// This works fine - int satisfies Number constraint
	result1 := Add(5, 3)
	fmt.Println("5 + 3 =", result1)

	// This works fine - float64 satisfies Number constraint
	result2 := Add(2.5, 1.3)
	fmt.Println("2.5 + 1.3 =", result2)

	// This will cause a compile error - string doesn't satisfy Number constraint
	result3 := Add("hello", "world")
	fmt.Println("Concatenation:", result3)
}

// section: violation

// section: error
// ./main.go:23:19: string does not satisfy Number (string not in int | float64)

// section: error
