How to Create an Infinite Loop in Python 


               


How to Create an Infinite Loop in Python



Python


In this article, we show how to create an infinite loop in Python.

An infinite loop that never ends; it never breaks out of the loop.

So, whatever is in the loop gets executed forever, unless the program is terminated.

For certain situations, an infinite loop may be necessary.

A very basic way of creating an infinite loop in Python is to use a while statement.

This is shown below.







This goes on forever and ever, unless the program is terminated.

So, this is how you can create an infinite loop in Python.


Related Resources

How to Show All Tables of a MySQL Database in Python

How to Count the Number of Rows in a MySQL Table in Python



HTML Comment Box is loading comments...