if statement and for loop