Q. What is an infinite loop? Give one example.


Answer :-

Infinite loop means that loop can never stop / terminate.
They can occur in the absence of a terminating condition.

Or

The statements within the body of the while loop must ensure that the condition eventually becomes false; otherwise, the loop will become an infinite loop, leading to a logical error in the program.

Example :-

I = 0
while True :
    I += 1
    print(I)


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post