The loop that never reaches its next step

A loop tells a program to repeat an action, often while a condition is true. An exit condition is the rule that eventually tells it to stop. If the loop’s work never changes what that rule checks—or no stopping rule exists—the program can keep circling through the same instructions indefinitely.

For example, a loop might keep asking whether a task is finished. If the code never marks the task finished, the answer stays “no,” so the loop asks again. The computer is not reconsidering the problem; it is faithfully executing the same steps over and over.

Why a small mistake can stall a program

Each repetition consumes processor time. A tight loop may use a core continuously, making an application unresponsive or slowing other work. If the loop also creates data or repeatedly sends requests, it can consume memory or overwhelm another service. The visible symptom might be a frozen window, a busy process, or a system that stops responding promptly.

Not every long-running loop is a bug: servers and games often use loops deliberately to wait for events or keep updating. The difference is that a sound design gives the loop a way to pause, respond, or stop—for instance, when a user closes the program or a task completes.

Give repetition a way out

Programmers prevent accidental endless loops by checking that each pass moves toward a stopping point, and by testing boundary cases such as empty input or a task that never completes. A limit on attempts or a timeout can provide a fallback when progress stalls.

The key question is not simply “Does this repeat?” but “What can change so it eventually stops?”