implemented loop statement