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

Almost the same as what Goofballtech had

int flag = true;

if (flag){
  // Do some stuff;
   flag = false;
}

Rob