Saturday, January 16, 2010

What value is used to control how the loop control variable is incremented in a for loop?

What programming language are you using?





Java, JavaScript, C++, php... ?





All of these languages are similar. Here is a for-loop in Java.





for (int i = 0; i %26lt; n; i++) {


Sytem.out.println(';i = '; + i);


}





In the above code, the variable named ';i'; is set to zero for the first iteration and is incremented by one each time that the loop is executed.

No comments:

Post a Comment