Why we use i, j, and k in for loops
tech.ablegray.com
tech.ablegray.com
The use of x, y and z as unknown reals goes far as back as Descartes. I don't know what he used for integers though, or whether he bothered to distinguish integers from reals.
Which came first, the chicken or the egg? Math or Fortran?
For example, to type "for f", you would press the 'f' key twice, as it had the shortcut 'For' on it, and also was the letter f. Similarly, to type "next n", you'd hit the 'n' key twice.
Perhaps why you sometimes see f and n in for loops.
Nah. A variable name's descriptiveness (and length) should be proportional to the size of the scope in which it's used. A simple loop index should almost never be longer than i, j, k, etc.
for i in $(exceptionally long pipeline that doesn't work right now)
Because someone didn't tell you what I was supposed to be.
Or being a few lines down the bottom of a very long loop, and trying to remember what 'i' represents this time round.
float f;
unsigned u;
char c;
key_t k;
That's how I swing, man.On standard keyboards "i" is just above "j & k". Also in basic typewriter tuition, your right hand apposing finger starts on the keyboard at the letter "j" when you commence typing. "k" has your right index finger. Most people being right handed these letters are pretty much the first & most intuitive letters to use.