riwu
2014-10-09 07:02:06
var
i: Integer;
a: TIntegerArray;
begin
SetLength(a, 1);
for i:=0 to High(a) do
begin
writeln(i);
SetLength(a, Length(a) + 1);
end;
end.This will result in an infinite loop in PascalScript because the loop's end condition – High(a) is rechecked every loop,
but it will terminate after 1 loop in lape, so i thought that perhaps lape's for loop has its end condition evaluated only once
at the start for efficiency purpose, but when i tested the following:
var
i, e: Integer;
a: TIntegerArray;
begin
SetLength(a, 1);
for i:=0 to e do
begin
writeln(i);
Inc(e);
end;
end.
This results in an infinite loop in lape too, so i'm wondering why in the first example it terminates after 1 loop?@Nielsie