Computer Science
What are endless loops ? Why do such loops occur?
Python Control Flow
16 Likes
Answer
A loop which continues iterating indefinitely and never stops is termed as an endless or infinite loop. Such loops can occur primarily due to two reasons:
- Logical errors when the programmer misses updating the value of loop control variable.
- Purposefully created endless loops that have a break statement within their body to terminate the loop.
Answered By
9 Likes
Related Questions
What are jump statements? Name them.
How and when are named conditions useful?
How is break statement different from continue?
Rewrite the following code fragment that saves on the number of comparisons:
if (a == 0) : print ("Zero") if (a == 1) : print ("One") if (a == 2) : print ("Two") if (a == 3) : print ("Three")