The loop is not infinite, yet for some reason the “infinite loop detected” warning still pops…
What the code does is pretty simple - There are 2 variables (allergy-weak & allergy-strong) that contain certain time (let’s say for example one of them has 5 seconds inside it and another has 0 seconds).
The loop pretty much just counts 1 second by running a delay of 0.1 seconds 10 times (it also reduce the time from the 2 variables, for example if 0.1 seconds pass, then allergy_weak = allergy_weak - 0.1, same for allergy strong). Every 1 second it does something once and then goes back to the loop.
The code stops (getting out of the loop and not coming back to it) when the time in both variables is 0 or less (in the example of one of them being 5 and the other being 0, the loop that runs 10 times would be called 5 for maximum of getting into the loop body 50 times times and then the function would finish)
Close up of the body loop
and what comes up after it just in case…
I have no idea why this warning triggers here or what to do to remove it considering there’s no infinite loop here (it runs until both variables value is 0).
EDIT: I tried replacing the loop with 10 times copy paste of the code and it works perfectly. So why does the fact i use a for loop cause it to crash?