I ran into strange situation here is what happens. I am using a do while loop and it exceutes a while function one more time after brake.
Here is a simplyfied version of what happens:
int i = 0;
do{
if(i>=1) break;
}while(i++);
And after this i value is 2. I am just curious if that is how it should be or I just made an error somewhere in my more copmlex version of this code?
This is an easy fix for this I just have to assign a to say an iTemp variable in the begining of the wgile and use that insted of i.
P.S. I was using two do while loops one inside of another maybe that is what caused it?
EDIT: Cmon people give me a break it was typo. 😀
It could well be. A
break(note the spelling) will only break out of one loop, so if it was inside the inner loop, it would break out of that loop, but continue execution immediately after the end of the inner loop. In the (fairly common) case of the outer loop ending immediately after the inner, you’d end up executing the condition of the outer loop again.