This is because the variable i is initialized to 0 at the beginning. Then, because i is less then 5, it will keep running the code block until i is not less than 5. This happens because the i++ increases i everytime, after, the code block (i.e. the print) is executed.