3 ms·
Context matters too though — As a general rule "i" is a terrible name for a variable but in a simple unnested loop it's expected. All these shorthands (e.g. K
by another-dave 6y ago
Context matters too though —
As a general rule "i" is a terrible name for a variable but in a simple unnested loop it's expected.
All these shorthands (e.g. K,V = Key,Value) have to be learned so should be used sparingly but in some places I think having shorthands for things like generics & indices allow boilerplate code to "get out of the way" of the business logic.
You expend less mental energy trying to keep track of "i" (as you know it's a simple loop counter) than "index". And reducing cognitive load is the point of having descriptive names in the first place.