[scribus-dev] for i

Gregory Pittman gpittman at iglou.com
Wed Sep 21 16:20:15 UTC 2011


On 09/21/2011 11:54 AM, a.l.e wrote:
> hi
>
>
> having been hacking a bit on scribus lately, i was wondering why each "for loop" has a different letter as the index.
>
> personally, i've learned to always use i, j and k (in this order, avoiding nesting them if possible) for the "for" loops.
>
> the big advantage is that each time you see an i, a j or a k you know it's a counter and just have to look at the definition of the loop to check what its value means and understand what it does.
>
> currently, any single letter or combination of two letter is in use. that way you have to go up the code one line at a time and see where the "a" (or c, or p, or pa...) is defined... until you get to the loop definition.
>
> or are scribus developers only using single letter variables for the loops?
>
> does anybody agree on using "i" whenever it's possible?
>

some might argue this is an ancient carryover, without clear value. I 
can certainly envision usage of other letters whenever this helps 
clarity in some way. I could imagine using something else temporarily 
(at least) while I work on some section of the code so I could easily 
come back to it.

I wonder if the first programmer to use i as an index ever considered 
the legacy he was creating?

Greg




More information about the scribus-dev mailing list