Curriculum Foundations Numeric primitives exercise 1 · mcq
Numeric primitives
TypeScript collapses all numbers into one number type. Go
distinguishes by size and signedness. For an integer literal like
this, the *default* Go type — and the one you reach for unless you
have a specific reason not to — is one of the options below. Pick
it.
TypeScript reference
About this theme
TypeScript has one number type. Go has many: int, int8, int16, int32, int64, uint* mirrors, float32, and float64. The big idea: Go has no implicit numeric conversion. A function expecting int64 will not accept an int32 without an explicit cast. This frustrates briefly, then becomes a feature.