Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 5
    If I had to work with you, we'd have a religious war/Jihad. Commented Apr 28, 2011 at 3:36
  • 1
    If the loop body is long enough to hide the meaning of i, isn't it time to refactor? Commented Apr 28, 2011 at 11:25
  • 3
    +1 for nested loops. Simple variable names can improve the readability of a nested loop. For example, when iterating through a 2D array or a table, labeling the variables row and column can be more readable than i and j. Commented Apr 28, 2011 at 20:48
  • to me myArray[i] is way more readable than myArray[myIndexArrayDescribingSomethingTooLong] Commented Dec 22, 2014 at 14:50
  • 1
    @im_a_noob: Then you probably never had to debug somebody else's code that was littered with expressions like myArray[i][j] and myArray[j][i] (which one's the right one? i was the employee index and j the project index, right? Or was that the loop above?), or my favorite: myArray[l][I][1] (no, they're not all three the same character). Code like that probably started its life as a 1d-array with one loop variable, but it didn't stay that way... Commented Dec 22, 2014 at 15:17