I have the following Java while loop:
boolean finish = false;
int ii = 0;
int counter = 0;
while((!finish) || (counter <= 10)) {
ii++;
if(ii<30) {
System.out.println(ii + " -- " + counter);
}else {
finish=true;
}
counter++;
}
I want the loop to add one to ii until it reaches 30 or the counter reaches 10. Running this code ignores the condition of counter and continues until ii reaches 30. I expect it to stop when counter reaches 10.
How can I fix that?