implement the for loop