Generic functions and types (Go 1.18+)
Type parameters [T any] reduce boilerplate without sacrificing type safety. Constraints live in interfaces or the built-in comparable.
Best practice: Reach for generics when duplication is real — do not generic-ify everything for sport.
Output
Press Run to execute your code.