magic for loop demystified