<P> Loop counters change with each iteration of a loop, providing a unique value for each individual iteration . The loop counter is used to decide when the loop should terminate and for the program flow to continue to the next instruction after the loop . </P> <P> A common identifier naming convention is for the loop counter to use the variable names i, j, and k (and so on if needed), where i would be the most outer loop, j the next inner loop, etc . The reverse order is also used by some programmers . This style is generally agreed to have originated from the early programming of FORTRAN, where these variable names beginning with these letters were implicitly declared as having an integer type, and so were obvious choices for loop counters that were only temporarily required . The practice dates back further to mathematical notation where indices for sums and multiplications are often i, j, etc . A variant convention is the use of reduplicated letters for the index, ii, jj, and kk, as this allows easier searching and search - replacing than using a single letter . </P> <P> An example of C code involving nested for loops, where the loop counter variables are i and j: </P> <P> This C - style for - loop is commonly the source of an infinite loop since the fundamental steps of iteration are completely in the control of the programmer . In fact, when infinite loops are intended, this type of for - loop can be used (with empty expressions), such as: </P>

When do we use 'loops' in programming