First Taste of Generics in Go
This friendly, down-to-earth tutorial explains what generic functions and types are, why we need them, how they work in Go, and where we can use them.
Generic functions in Go#
func PrintAnything(type T)(thing T) {
}
func main() {
PrintAnything(int)(99)
}