5/19 just how bad are infinite loops?


It keeps saying "make sure to fix that" when talking about "infinite loops" So what would actually happen were an infinite loop created, and should one be created how should it be dealt with?
just curious. (it's a shared computer otherwise I would have just created it, and seen what would happen, it's not permanently damaging right?)


Actually, I created one in the last exercise by accident and it just keeps going until you refresh the browser or the programming inside the web page tells you that the loop has been running for a suspiciously long time. :smile: Im also curious what would happen in real world programming if you created an infinite loop and just let it run. Computer explosions?


If you run it here on codecademy, it seems like just refreshing browser resolves the issue. I once run a infinity loop in php directly on my computer, my computer no longer responded (had to hold the power switch)

If you run a infinity loop in python? If you are lucky the program crashes, if you are not so lucky your computer crashes. Too many variables to tell which of the two is going to happen.


so what do you mean computer crashes? just a forced shutdown becuase it cannot handle the loop, or like permanent damage? what is the extent of the damage? (worse possible scenario, just for the sake of argument)


Computer crashes -> nothing responds, you have to hold the power button, nothing else worked. For the rest, software can't do any damage to hardware


So all in all, while not desirable, it's not terribly damaging?


No, it is not. It is mostly annoying because you have to interrupt your workflow, and it is a silly mistake to create a infinity loop.


Awesome, thank you for being so helpful :smile: