Keep track of how many times a function has been run

Soo what if A runs 3 times correctly but B doesn't ?

Anyways, wouldn't a global counter var be an idea ? and use conditions.

acounter = 0;
bcounter = 0;

then in the a and b function run this from the "succes" part of the function
if((acounter < 3) { a++; } runC();
if((bcounter < 3) { b++; } runC();

for c:
if(acounter ==2){ do things then reset counter; acounter = 0;
if(bcounter ==2){ do things then reset counter; bcounter = 0;

is it pretty ? nah would it work ? i think so. i'm probaby overlooking something in your request..

1 Like