Go · Concept
Generics
Go generics let one function or type work with a permitted set of types. Type constraints limit the choices, and Go can often infer type arguments from function arguments.
Last updated
- Since
- Go 1.18
Syntax
func SumNumbers[K comparable, V Number](m map[K]V) VIn-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
type parameterstype constraintstype inferenceinterfacescomparableSumIntsOrFloatsSumNumbers