You're looking for a while
-loop:
while(condition)
{
// do stuff
}
Or possibly a do-while
-loop:
do
{
// do stuff
} while (condition);
The difference here is that the while
-loop always evaluates it's condition before the first iteration while the do-while
-loop evaluates it after the first iteration.
Further Reading