Parameter tipe Golang
// before generics feature in golang, we could only pass
// one type as a function parameter
// for example SumInt func can sum only int type
// and we can not sum of float or other type
// and we will have to write new func SumFloat for float type
func SumInt(a, b int) int {
return a + b
}
func SumFloat(a, b float64) float64 {
return a + b
}
// type parameter allows us to work on multiple types
// here we defined T as type parameter allowing int and float64 type
func Sum[T int | float64](a, b T) T {
return a + b
}
Glamorous camel