2013-05-26 4 views

ответ

4

Похоже, вы хотите continue.

while (health > 0 && enemyhealth > 0){ 
    ... 

    if (...) 
    { 
     ... 
     continue; // This will skip the rest of the loop body, 
       // check the loop condition again, and keep going 
       // if the while condition is still true 
    } 

    ... 
} 
2

Использование continue

while(health > 0 && enemyhealth > 0){ 
    if(attack) 
    { 
     attack 
    } 

    if(view stats) 
    { 
     console.log(stats) 
     continue; 
    } 

    enemy attack 
} 
Смежные вопросы