You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 5, 2023. It is now read-only.
That is a mistake that I did a lot of times too. You are not updating x. So, it is always 1 and hence, an infinite loop. In this iteration, I am just letting it go. There is no detection mechanism for an infinite loop.
Now that I think about it, it seems that it is very difficult to detect an infinite loop. If the user is printing something, the buffer may get filled with a lot of data and that would hint that something is wrong in the code. But this would only be the best case. What if user doesn't print anything? Well, then we will never know if the code has an infinite loop. A possible solution would be after every iteration in a while loop, we check any of the variables in the scope have changed their values but then it will become very inefficient and also, what if the user changed some value which is not affecting the expression check of the loop? There are a lot many possibilities and cases that would need to be handled and I don't think that is humanely possible to do that.
Anyway, if you got any idea, I am all ears.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The webpage crashed!!
The text was updated successfully, but these errors were encountered: