18 ms·
It's not only not really idiomatic, it's almost never necessary in practice. I was struggling to think of a time I'd ever given a type annotation to an integer
by leoedin 2y ago
It's not only not really idiomatic, it's almost never necessary in practice.
I was struggling to think of a time I'd ever given a type annotation to an integer local variable - because normally the place the variable ends up dictates the type.
Local variable becomes part of struct? Struct dictates type. Passed into function? Function dictates type. Multiplied by other variable and then that is passed to function? The type is determined by the function.
- School-Cotton 2y agoIt can be necessary if you’re passing it to a generic type/function.