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

If it's not too much trouble to ask - could you post an example for using a boolean variable with this code?