Repeating only a specific condition during a loop

I agree there are better ways for doing it, but if you look at the original post there's not alot to go on