+ 3
For loops
I know this question is kinda strange, but why are the variables in for loops often named âiâ? It would make much more sense to name them âaâ and go in alphabetical order if you have a for loop inside another one.
6 RĂ©ponses
+ 7
I would agree with Jamie. "i" is used as an indexer in sequences in math. It is likely carried over to programming for that reason as loops are effectively creating a sequence.
+ 7
"I" isn't compulsory.Its just something programmers have gotten addicted to.You can use other variables as iterators if you want
+ 5
It's just used for convinence I think. As we say x,y,z axis not a,b,c axis. In series and sequence we let 'nth' term not 'ath' term. While removing proportionality we let 'k' to be proportionality constant, not a. We let angles as 'theta' and 'phi' not a,b. We let polar co-ordinate as (r,theta,phi) not (a,b,c). The reasons are same. Other coders are saying that "iterator" was the reason to choose this convention.
+ 4
any help on my question!
https://www.sololearn.com/discuss/946841/?ref=app
+ 2
I = iterator
often replaced with "iter"
tho iter should be reserved for vectors and the like when using actual iteration types.
- 1
maybe because usually they are used as indexes for array.