implementing `for-each`