Added a condition with a loop

Added a condition with a loop