lundi 18 septembre 2017

Moving to a previous statement inside for loop

I have a for loop similar to the one given below.

for(int i=0; i<10; i++)
{
   boolean condition = checkCondition();    /* line 3 */

   if(condition)
   {
     if(some other condition A)
     {
       move to line 3;
     }
     else if(some other condition B)
     {
      call_method_B();
     }
     else
     {
      call_method_C();
     }
  }
  else
  {
    call_method_D();
  }
}

How do I make the program go back to line 3 within the if statement as above? I don't want to break the iteration. Needs to be in the same iteration and only need move back to line 3.

Aucun commentaire:

Enregistrer un commentaire