+ 2
Why we write 'i' in For loop??
17 Answers
+ 4
i == iterator or index
My understanding has always been 'i' is a good choice since loops are typically for iterating or traversing with a known index step. The letters 'j' and 'k' follow well since nested loops are often needed and most will instinctively know 'j' == second index and 'k' == third index since they follow that pattern in the alphabet. Additionally, with many following this standard convention, one can safely assume a 'k' loop will likely have a 'j' and 'i' loops wrapping it.
i is just variable it is mostly used in for
+ 10
i is just variable like int i, int j, int k. You can use anything in loop like
for(int j = 0; j < 10; j++) {
}
It is not necessary to use only i.
+ 5
It's just a variable that assumes the values of the elements of an iterable object. Probably because generally we use for loop to iterate over arrays where "I" represents "index" of a value
+ 5
It is not necessary we can use what we want general I represents the starting letter of index
+ 5
It is just variable we can use anything as a variable in for loop
+ 3
i is just a variable. there's nothing special
+ 3
Normally when we are writing loops conditions in programming we used to use i j k like variable.that is not a standard. as well as if we are doing a project with proper coding styles that are not good. always try to initialize a variable with a proper meaningful name.it will help to debug the program easily.
+ 2
It is common practice to use i in for loops. This is just what programmers are used to.
+ 2
It may relate to the concept of dimension in 3D space in mathematics.
The 3 mutual orthogonal unit vectors i, j and k represent the row, column and depth of a 3D array.
+ 2
Its not actually that we always write i in for loop
i is actually a variable and you can have any variable any character or string
i is commonly used , that's true but you can use any variable
+ 1
because we didn't use w
+ 1
u can use item or things
+ 1
It's an iterative variable we can use any other valid one
+ 1
We use "i" for the purpose of iteration , its just a general practice to use the letter "i" you can use whatever you like for example x, y, z, alpha, beta, gamma, etc.
0
I is use to drive for loop
0
I is just the variable
You can use others
But it's famous because its symbolises iterative
0
It is just a variable, you can use any word or letter of your choice