+ 5
What is the best use of infinite loop?
I was doing the python course and I found that one can create a infinite loop, but where is can be used?
2 Answers
+ 11
I use infinite loops a lot. If you have nested loops and the exit condition of the outer loop is based on the value of a variable who's scope is limited to the inner loop, the outer loop can't test it so it needs to be infinite.
+ 10
infinite loops are used in apps, for example the "main loop" you stop it by the app exit key, also in games you might run a program that controls the player as long as the game is running.