answersLogoWhite

0

By changing the loop counter variable within the loop can cause the loop to exit early or to loop more times than the limit.

The is nothing that says that you can not change the loop counter variable within the loop, you may indeed want to do that. Just be careful and be sure of what will happen.

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Print 1-10 numbers using while loop?

public static void main(String args){ int counter = 0; //initialize the counter variable to 0 while (counter < 10){ //while the counter variable is less than 10... counter ++; //increase the counter variable by 1 System.out.println(counter); //print the counter variable } }


Does every statement have a counter example?

Only some statements have both examples and counter examples. A sufficiently clear and unambiguous statement would not have counter examples.


What is a musical statement followed by a repeat of that statement and a counter statement called?

binary form


A loop control variable that is incremented a specific number of times is known as?

A loop control variable is widly known as a "counter".


How can I determine the number of iterations a loop runs in Java?

To determine the number of iterations a loop runs in Java, you can use a counter variable that increments each time the loop runs. You can also use a conditional statement to check when the loop should stop running. By keeping track of the counter variable, you can determine the total number of iterations the loop has executed.


Is it counter-productive to change or update you personal mission statement?

s it counter-productive to change or update you personal mission statement?


What is counter loop?

A counted loop is a loop that executes the loop's statement a pre-determined number of times. The count represent the exit condition of the loop. A loop that is not counted is an infinite loop.


What is the correct way to add 1 to the count variable?

A counter variable is "incremented" (the step number, 1 in this case, is added to it) in any of the following four ways: $counter = $counter + 1;$counter += 1; //this is shorthand for the above $counter++; //postfix increment operator $counter = 0;echo $counter++;The output would be 0++$counter; //prefix increment operator $counter = 0; echo ++$counter;The output is 1


Can you display the contents of the counter variable in the body of a loop?

Yes.


What is a statement that shows conjecture is false?

A counter example is a statement that shows conjecture is false.


What does a counter withdrawal on your bank statement mean?

it is william


What is the if-then form of A counter example invalidates a statement?

You figure it out!