An "infinite loop" is a loop in which the exit criteria are never satisfied; such a loop would perform a potentially infinite number of iterations of the loop body. The general problem of determining whether the execution of a loop with given preconditions will result in an infinite loop is undecidable; in other words, there is no algorithm to determine whether an execution of a loop will eventually terminate. This is known as the halting problem.
Questions tagged [infinite-loop]
3528 questions
1
vote
1 answer
Infinite Looping Caused by Exception Handling
What I want this code to do is handle the exception, and then simply repeat. What it does instead, unfortunately, is loop infinitely... I can't figure out why.
It never asks for the input to be re-entered, seemingly setting it for good the first…

scbmirmiran
- 35
- 5
1
vote
1 answer
StackoverflowException in list
What is wrong with this code? I keep getting a StackOverlflowException..
public class Places
{
public string Title { get; set; }
public string Content { get; set; }
public double Latitude { get; set; }
public double Longtitude { get;…

user3478148
- 433
- 1
- 8
- 26
1
vote
5 answers
c program for printing each word in string backwards
this is my source code for printing each word in string backwards. but this code is just printing the 1st word backward and not the entire string. after printing 1st word backward it generates a pattern of 1st and 2nd words printed backwards. If…

Bob
- 21
- 1
- 1
- 6
1
vote
1 answer
Breaking out of infinite loop
My code is not allowing me to break out of the infinite loop, and therefore exit the program. Here is my code:
while True:
print("\n1. Surname\n2. D.O.B\n3. Quit")
try:
select = int(input("Please select an option: "))
…

user3165683
- 347
- 1
- 9
- 28
1
vote
2 answers
Infinite viewpager with position indicator
Infinite looping viewpagers rely on an illusion where the count of items is increased to an arbitrarily large number, which are mapped via modulus to index positions in a list.
The problem with this being that indicators such as Circle page…

CQM
- 42,592
- 75
- 224
- 366
1
vote
4 answers
PHP infinity loop [While]
I am having some problems with PHP.
I used while to sum a number's digits always that it has more than two digits, some how, it gets into an infinity loop.
e.g: 56 = 5 + 6 = 11 = 1+1= 2.
Here is the code:
$somaP = 0;
$numPer = (string)$numPer;…

Anderson
- 59
- 1
- 7
1
vote
4 answers
How to detect infinite loop in .NET without managed debugger
One our customer has trouble with our application written in .NET. It consumes entire CPU after the start of the process without any windows to show. It looks like an infinite loop.
The problem is, that this customer has Windows 7 Home Edition and…

Tomas Kubes
- 23,880
- 18
- 111
- 148
1
vote
1 answer
Why javascript continues after I close my android app?
I made an android app that shows an internal html with javascript in a webview. The javascript has an infinite loop to update the view once each minute.
The problem is that after I close my app with the back button, the javascript continues its…

Luis A. Florit
- 2,169
- 1
- 33
- 58
1
vote
3 answers
Issue with finding the end of a file?
having an issue reading input from a file, counting the amount of characters in each word, then outputting this count to an output file.
example content in input file:
one two three four five
correct output would be:
3 3 5 4 4
Now the code below…

user3504915
- 13
- 2
1
vote
1 answer
Infinite loop when simulating a Program Counter design with Icarus Verilog
I am implementing a simple Program Counter adder with the following prototype:
module program_counter(input enable_count,
input enable_overwrite,
input[31:0] overwrite_value,
…

Patrick Samy
- 156
- 1
- 10
1
vote
4 answers
Infinite while loop involving boolean variable in Java
this is my first post, so apologies if I fail to follow proper formats/conventions etc. on this site. I've only been programming for a few weeks.
Anyways, I am writing a basic Java program using a boolean variable and a while loop. The code is very…

user3499940
- 11
- 2
1
vote
1 answer
Task with infinite cycle
I'm new in C#, I've gone to it from Delphi. So may be I do something wrong. My app (windows service) make tasks to control on-off states and count "on" time. I've tried to use Task.Delay(x), but it seems I catch deadlocks...
Main idea make tasks…

sad1002
- 29
- 4
1
vote
2 answers
C++ getline() reading in line of file infinitely loops through file
I'm trying to read in a line of the file, print out parts of the line, and repeat the process for the next line of the file.
but it doesn't work properly, when I push the output to cmd line it becomes apparent that the while loop is never…

stell1315
- 153
- 1
- 2
- 9
1
vote
2 answers
PHP abort infinite loop on user disconnect
I am doing a minor experiment with PHP. I have a file named 'infinity.txt', and in that file, I write an incrementing number every 0.25 seconds.
while(true){
file_put_contents('infinity.txt', ++$i.PHP_EOL, FILE_APPEND);
usleep(250 *…

arik
- 28,170
- 36
- 100
- 156
1
vote
1 answer
How to break a for loop?
I came up with the idea of putting the for loop in a thread, so that all I would have to do is pause or delete the thread to break the for loop. However, it gets a little more complicated than that. I am making a Call of Duty Modern Warfare 2 mod…

user3343925
- 53
- 7