condition added to for loop