Getting started
This section reviews how to get started with Golang generics.
- What is a generic?: a quick look at generics in general
- Syntax: how to write generic code
- Constraints: expressing what satisfies a generic type
- The
any
constraint: the newany
keyword - Composite constraints: elegantly expressing more than one compatible type
- Tilde
~
: how to use tilde~
when expressing constraints - Type inference: when the compiler figures out intent
- Explicit types: how to explicitly state intent
- Multiple generic types: using more than one generic type
Next: What is a generic?