Making the loop work for switching roatation movement

Hello everybody, I am trying to find out how I can loop the following: a rotating object which changes rotation after every x seconds. Anyone able to help? Thank you.