What is Infinite Loop ??
Tags: beginners, todayisearched, todayilearned, computerscience
Published: 2019-07-11 18:17:11

The infinite loop also called endless loop is a type of loop that never ends. Instructions inside the loop will execute endlessly.

###The reason behind the occurrence of Infinite loop
---
Generally, there are six reasons that become the reason behind the occurrence of an infinite loop.
1. No terminating condition
2. Having one condition that can never be met
3. Having a condition that causes the loop to start again and again
4. Miss the incrementer or decrementer (if your logic needs one)
5. continue statement in the wrong place (if your logic needs one)
6. wrong comparisons in loop condition (less than or greater mixed up)

So whenever you get an infinite loop just check from these six conditions, there are high chances that you’ll get your mistake.

###The harm that Infinite Loop can do
---
Mainly Infinite loop can harm your system in two ways:

* **By using your processor time and power —** As a general rule if your processor is working on any process it takes time and power to do it. Same as any other process Once started infinite loop will use your processor time and power. And at one point in time, it slows down your system and made it unresponsive.

* **By using your memory —** In computer mainly all running processes reside inside the RAM. And when an infinite loop occurs, it just started to fill up your RAM space and at one point of time your system will run out of memory and it can results in complete system failure.

Yes, that’s also true that modern operating systems like Windows 10, Linux and macOS have a pre-defined mechanism to handle this kind of processes. After reaching a certain level these operating systems can automatically kill these kinds of processes to avoid complete system failure. But again if implemented in a proper way an infinite loop can damage a lot.

###How to Stop Infinite Loop
---

If you’re a developer and if you have an infinite loop in the terminal application then (ctrl+c) will usually stop it. If it is graphical application then you can kill the process via Task Manager or if you are using IDE then find the stop button. In most cases, this will terminate your infinite loop.

So, guys, that’s it for an infinite loop. Don’t afraid if you have one. Every programmer meets with an infinite loop once in a life. Just drink a cup of coffee, keep your mind cool and check from above six conditions you’ll definitely find the solution.

Feel free to let me know if I miss something, I’ll love to learn it from you. Till then Keep Loving, Keep Coding. I’ll surely catch you up in the next article.

Jai Hind, Vande Mataram 🇮🇳

Wanna get in touch with me? Here are links. I’ll love to become your friend. 😊

- [My Site] (https://www.jaytillu.in)
- [My Blogs] (https://blogs.jaytillu.in)
- [Twitter](https://twitter.com/jay_tillu)
- [Facebook](https://www.facebook.com/jaytillu.1314/)
- [Instagram](https://www.facebook.com/jaytillu.1314/)
- [Medium](https://medium.com/jay-tillu)
- [LinkedIn](https://www.linkedin.com/in/jaytillu/)
- [Github](https://www.github.com/jay-tillu)
- [Stack overflow](https://stackoverflow.com/users/8509590/jay-tillu)
or just mail me at jd.tillu@gmail.com