every loop can be every other loop.
a while for loop looks like:
for(; condition ;) //blank initialize and blank increment portions.
to convert a standard for loop to a while, you just need:
initializer; //eg int i = 0;
while(condition)
{
increment; //eg i++;
}
and so on. ranged based while loop would be idiotic but you can do it with pointers or iterators manually if you had a range based for loop.
you use the one that is cleanest for the problem, but any will suffice.
Last edited on