628
why not a,b or x,y?
(lemm.ee)
Post funny things about programming here! (Or just rant about your favourite programming language.)
A useful tip I picked up was to use
ii
instead ofj
for an inner loop. It's far more distinct thanj
.If for some terrible reason you have even more inner loops you can easily continue the trend
i
,ii
,iii
,iiii
,iiiii
- oriv
,v
if you're feeling romanIf you have the need to nest 5 levels of for-loops, I suggest taking a step back and rethinking your approach, my friend.
Even if that other approach is just refactoring it into separate methods.
I just do i2, i3, etc
Becomes unreadable if you're using the iter values a lot
Two or three "i"s is readable, but any more and you're counting.
I'Ve started using i, k, m, n that's usually enough.
At this point we might as well go full Roman as you suggested. MXMCIIV to MXMCCVII as indices.
When you have multiple indices you're also bound to have multiple cardinals those indices count up to, say
foo.length
andbar.length
, sofoo_i
andbar_i
are perfectly legible and self-documenting. A bit Hungarian but Hungarian is good in small amounts. Unless you're dealing withwidth
andheight
in which case it'sx
andy
but it's not thatwidth_i
would be incomprehensible.