When you put a semicolon, he finish the code, so when you put after parenthesis you finish the for loop and then print the last 'i', that is 5