Modify variable while loop from "outside"
What I'm trying to do is modify a global variable from outside while my programm is in a loop. The point of this is to be able to stop the loop at all times just by clicking a button.
if button pressed -> startState = false;
I noticed that the variable is changed only after the loop finishes by itself ...
Is there a way to do this ? Heard something about multithreading, but im not sure how to implement that one.
Tks in advance