Is it possible to mid while loop, return to the beginning of the loop?
Something like this
while(this is true)
{
do stuff...
if(this is true)
{
restart while loop;
}
}
Adding clarity: I did not mean restart as in reset variables, I mean restart in the sense of stopping execution and going on to the next iteration.
the
continuekeyword will do thatBasically,
continuestops execution of the loop on the spot, and then goes on to the next iteration of the loop. you can do this with other loops such asforloops too.