Java While Loop

java, while-loop

Solution

the `continue` keyword will do that

while(this is true)
 {
      do stuff...
      if(this is true)
        {
            continue;
        }
  }

Basically, `continue` stops 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 as `for` loops too.

Problem

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.

Original source