Timeline for Why do most of us use 'i' as a loop counter variable?
Current License: CC BY-SA 3.0
16 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 13, 2017 at 18:56 | history | edited | Deduplicator | CC BY-SA 3.0 | added 29 characters in body |
| Jul 14, 2015 at 18:47 | comment | added | John R. Strohm | @LouisRhys, what kind of reference are you looking for? If you want one about the mathematical notation, almost any linear algebra textbook will show plenty of examples. Ditto any competent numerical methods text. If you are looking for a FORTRAN reference, dig out any OLD (by definition!) FORTRAN IV textbook. Alternatively, you could try to dig out an old FORTRAN reference manual (I think CDC document number 60279900 was the FORTRAN IV reference manual). | |
| Jul 3, 2015 at 14:28 | comment | added | sakis kaliakoudas | adding this question to my favourites, just for the "phsychosis" comment | |
| Feb 28, 2015 at 8:30 | comment | added | Craig Tullis | i and j are fine or even preferable in most cases, as Jerry alluded to. A bigger problem is loops that are so big you can't see and comprehend the whole thing on one screen. Those need to be refactored so that they're more concise. | |
| Jun 28, 2013 at 14:07 | history | made wiki | Post Made Community Wiki by user95187 | ||
| Jun 25, 2011 at 18:08 | vote | accept | kprobst | ||
| Jun 25, 2011 at 17:44 | comment | added | gbjbaanb | @quickly_now: that problem is with the rules, not the naming. If i makes sense, a rule that bans all 1-letter variables is wrong. Pragmatic would say that all variables be "descriptive of their purpose" and leave it at that. | |
| Jun 25, 2011 at 14:28 | comment | added | Jerry Coffin | @Louis: A reference for what? The rules in Fortran, use of i as a subscript before Fortran, or something else? | |
| Jun 25, 2011 at 14:26 | comment | added | quickly_now | The trouble with allowing the rules to vary (ie you can use "i", "j", etc, but only sometimes) is that the judgement call comes in - and then your nice flexible style guide results in 27 pages of crap with variables called "i", "r", and "rr". Just ban it. Thats not being psychotic, thats being pragmatic. | |
| Jun 25, 2011 at 9:46 | comment | added | Louis Rhys | @Martin Beckett @Jerry Coffin can you cite a reference? | |
| Jun 25, 2011 at 4:02 | comment | added | Martin Beckett | @Guy 'i' is for index, j is the next letter after i | |
| Jun 25, 2011 at 3:38 | comment | added | Guy Sirton | OK - so why are i and j used as subscripts in mathematics? I think this use predates FORTRAN :-) I'm sure Knuth knows... | |
| Jun 25, 2011 at 2:21 | comment | added | Crashworks | +1 for attributing to psychosis what some imagine to be style. | |
| Jun 25, 2011 at 0:14 | comment | added | Casey Patton | +1 I hadn't thought about the math correlation here. This was an interesting realization. | |
| Jun 25, 2011 at 0:10 | history | edited | Jerry Coffin | CC BY-SA 3.0 | edited body |
| Jun 24, 2011 at 23:58 | history | answered | Jerry Coffin | CC BY-SA 3.0 |