Previous Messages |
Posted By
Doug on 2019-09-22 12:23:15
| Re: For Next "i" variable
gerliczer is spot on - it's FORTRAN legacy. Variables beginning i - n were assumed integers. Anything else was a real. Hence it was shorthand to just use i or j or k for loop variables without explicit declaration. (Jeez - really showing my age now!)
|
|
Posted By
gerliczer on 2019-09-22 09:34:43
| Re: For Next "i" variable
It comes from the legacy of FORTRAN, AFAIK. Either 'i' (as well as 'j' and 'k') were the usual handbook examples or those had some specific optimizations in the compiler. Or maybe these names were defined default as integer variables. Unfortunately, I don't remember which of the three, but I'm sure that I already heard or read it somewhere.
|
|
Posted By
George on 2019-09-22 08:49:10
| Re: For Next "i" variable
I agree with Lavina.
Maybe also because "i" is such a short letter and loops are used often, therefore the code gets "visually" more compact. Also the following "j".
Programmers like it as minimalistic as possible.
|
|
Posted By
Lavina on 2019-09-22 08:04:21
| Re: For Next "i" variable
Good question!
It maybe comes from “index” or “integer” or from maths where for example sum goes from i=1 to n.
Once I also red somewhere that it could come from “Iteration”.
|
|
Posted By
SVS on 2019-09-22 06:58:22
| For Next "i" variable
Just for fun: does anybody know why in the most of cases of examples the control variable of a FOR...NEXT cycle is "i"?
|
|