AP® Computer Science A glossary
Infinite loop
Course: AP® Computer Science A Shows up in: Unit 2: Selection and Iteration
A loop whose Boolean expression always evaluates to true, so it never stops. It compiles; it is a logic error.
Appears in the course and exam description (CED): 2.7.A.2
Common causes: forgetting to update the loop control variable, updating it in the wrong direction, testing != against a value the variable skips, or a semicolon right after while (...).
int n = 0;
while (n != 10) { // n is 0, 4, 8, 12... never 10
n += 4;
} Learn it properly, with a checkpoint 2.7 while Loops