I am learning java as well android. Almost everything that we can perform by while loop those things we can do in for loop.
I found a simple condition where using w
You can do something like:
int counter; for (counter = 0; counter < 10; ) { //do some task if(some condition){ break; } } useTheCounter(counter);
Anything that a while-loop can do, can also be done in a for-loop, and anything a for-loop can do, can also be done in a while-loop.