Infinite Loop

Suggest Improvement

An infinite loop is a loop in programming that never stops running because the ending condition is never met (or missing).

Key idea:

  • Normally, loops run until a condition becomes false.
  • In an infinite loop, that condition always stays true (or there’s no way to exit).

Example (JavaScript):

while (true) {
  console.log("This will run forever!");
}

This loop will keep printing endlessly until the program is stopped.