better understanding of for loops