How to detect an update/change of a number?

I’m not really sure what the script is supposed to be doing. But I can see that there are three GHPython components, all with persistent variables, and one with a timer. This is likely needlessly complex and would be better managed with one component. If you’re looking to stop iterating once a certain condition has been met, you can do something like this:

And if the condition to check occurs downstream from GHPython component doing the iteration, you can use the sticky to pass this information upstream.