In Delphi, consider
var
i: integer;
begin
for i := 0 to N do
begin
{ Code }
end;
One might think that i = N
after the for
loop, but does the Delphi compiler guarantee this? Can one make the assumption that the loop variable is equal to its last value inside the loop, after a Delphi if
loop?
Update
After trying a few simple loops, I suspect that i
is actually equal to one plus the last value of i
inside the loop after the loop... But can you rely on this?