In Horstmann's textbook(Big Java Late Objects) on java, for a for loop such as :
for (i = 0; i <= 5; i++)
Horstmann says that values of i
for this for loop is 0 1 2 3 4 5
.
However, it seems to me that the value of i
should end at 6 since the loop is entered when the i
has the value 5 . What am I not understanding about this loops could someone explain me?
(PS. I am sorry if the question is too basic and thus not allowed in this platform.)
edit about the duplicate suggestion: My question is not a duplicate of the suggested link because the suggested link is about the execution of the for loop, mine is about the updating of the variable i , after the end of the execution. I understand that if I would add a System.out.print(i) statement the output will be 0 1 2 3 4 5 because i gets updated after the execution statement (in this case the print statement)