As Guirec Le Bars told you,
for loops[
^] are
intended to loop for a countable number of iterations, but that doesn't mean they cannot be used otherwise. The following example will loop as long as
condition
equals
true
.
for(;condition;)
{
Whatever();
}
There are three parameters to the for loop. The example omits the first and last and that compiles well.
[Edit]Corrected parameter order[/Edit]
But Guirec Le Bars is right for another reason: The for loop checks
condition before entering the loop. If it doesn't equal
true, no single iteration is done.
do{ }while()
on the other hand execute once and check afterwards, whether or not to repeat. So in spite of a condition that doesn't equal
true, the loop is executed once.