I can’t figure this out so maybe someone here can help me. I have a function with one argument and inside that function there’s code I want to run every x number of times.
void doSomething(int _arg){
// do something every 250 times
}
The function is called repeatedly but the argument isn’t augmented by 1. So for example the function calls might look like this and I want a condition inside the function to be run every 250 times.
doSomething(1); // do something
doSomething(130);
doSomething(230);
doSomething(310); // 250 was passed, do something
doSomething(420);
doSomething(570); // 2*250 was passed, do something
I can’t just do something like if(_arg % 250 == 0) because the value of _arg is irregular (but the intervals are always smaller than 250).
How about a static variable: