Introduction
Go is a typed language, which means that every variable and value in your program has some specific type.
When we write functions, we need to specify the type of their parameters in what is called the function signature.
func add(x, y float32) float32 {
return x + y
}
Considering the above function, imagine how repetitive it would be to redeclare the same function for all available numeric types.
What if we wanted to declare a function that specifies a group of possible types for an argument, and let the compiler "convert" that generic type to the type we use in calling the function ?
This is possible using generics, which we will see in more detail in the next pages.