An infinite loop is one that will never end while the program is running, i.e., you have to kill the program to get out of the loop. Whether it is
by meeting the loop's end condition or via a break, every loop should have an end condition.
yield is used - Issue #674.
for (;;) { // Noncompliant; end condition omitted
// ...
}
var j = 0;
while (true) { // Noncompliant; constant end condition
j++;
}
var k;
var b = true;
while (b) { // Noncompliant; constant end condition
k++;
}
while (true) { // break will potentially allow leaving the loop
if (someCondition) {
break;
}
}
var k;
var b = true;
while (b) {
k++;
b = k < 10;
}
outer:
while(true) {
while(true) {
break outer;
}
}