loop passed as parameter