Conditional looping

This was addressed in a previous topic: