package main

import "fmt"

// section: constraint
type StringOrInt interface {
	string | int
}
// section: constraint

func main() {
	// section: usage
	process := func[T StringOrInt](input T) {
		switch v := any(input).(type) {
		case string:
			fmt.Printf("Processing string: %s (length: %d)\n", v, len(v))
		case int:
			fmt.Printf("Processing int: %d (doubled: %d)\n", v, v*2)
		}
	}
	
	process("hello")
	process(42)
	// section: usage
} 