Iterates over a given collection with a for loop.