How to run through a loop once - and then resetting to make it available again

Establish a boolean var, using it like a flag bit.
So. some condition makes the boolean TRUE, so execute a function and before you leave that function, reset the boolean FALSE.