While and For loop impl