Converts a call to the forEach function into a for loop.