Keeping things that can be on one line to one line is a good reason to use short variable names where it won’t be confusing. Writing “iteration” sounds absolutely perverse!
The thing is, everyone understands i and j. The reason calling variables hcv or iid is dumb is because noone knows what that means - quite a different situation.
I like it to make it clear when the for loop is about iterating lists and when it’s not. For example, the iterations in Monte Carlo algorithms doesn’t correspond to items in a list.
I typically do too, or userIndex or something for nested loops, but I will accept i and j for the first two levels of nesting when reviewing a PR because they’re such a convention. I wouldn’t accept variable names like that anywhere else though and try and avoid them myself.
I’ve started to prefer writing it out as ”index” or ”iteration” even in for loop counters. It’s easier to read, and not much harder to type.
idxis the ideal name for an index, change my mindYh, y cn sv a lt f spc wtht ths unncssr vwls
I is a vowel too but you sure can!
Edit: also I noticed you dropped one ‘y’ but not the others. Is this an accident or some subtlety to do with y’s ‘semi-vowel’ status? To be discussed.
t’s prbbl t kp wrds rcgnzbl. Hw ls wld knw wht h s sppsd t b?
Keeping things that can be on one line to one line is a good reason to use short variable names where it won’t be confusing. Writing “iteration” sounds absolutely perverse!
The thing is, everyone understands i and j. The reason calling variables hcv or iid is dumb is because noone knows what that means - quite a different situation.
I like it to make it clear when the for loop is about iterating lists and when it’s not. For example, the iterations in Monte Carlo algorithms doesn’t correspond to items in a list.
I think even idx is better than just i. I feel like just i can visually get lost
I typically do too, or
userIndexor something for nested loops, but I will accept i and j for the first two levels of nesting when reviewing a PR because they’re such a convention. I wouldn’t accept variable names like that anywhere else though and try and avoid them myself.