Need to convert this for loop to a while loop

Posted by Bragaadeesh on Stack Overflow See other posts from Stack Overflow or by Bragaadeesh
Published on 2010-04-28T16:20:24Z Indexed on 2010/04/28 16:23 UTC
Read the original article Hit count: 332

Filed under:
|
|

Hi guys,

I solved a problem recently. But I have this one piece of code where I dont utilize the for loop initialization and condition check. It looks a bit odd that way for a for loop. I want to convert it into a while loop. Please help me do it. I tried many times, but somewhere something is missing.

for(;;current =(current+1)%n){
    if(eliminated[current%n]){
        continue;
    }else{
        inkiPinki++;
        if(inkiPinki == m){
            eliminated[current%n] = true;
            printStatus(eliminated, people);
            remainingGuys--;
            break;
        }
    }
}

In the above code eliminiated[index] is a boolean.

© Stack Overflow or respective owner

Related posts about java

Related posts about while-loops