Sieve of Eratosthenes: Difference between revisions

Content deleted Content added
Chkas (talk | contribs)
Avk (talk | contribs)
m →‎{{header|Free Pascal}}: to avoid error when list of primes is empty
Line 8,256: Line 8,256:
I: DWord;
I: DWord;
begin
begin
for I := 0 to aList.Size - 2 do
if aList.Size <> 0 then begin
Write(aList[I], ', ');
if aList.Size > 1 then
WriteLn(aList[aList.Size - 1]);
for I := 0 to aList.Size - 2 do
Write(aList[I], ', ');
WriteLn(aList[aList.Size - 1]);
end;
aList.Free;
aList.Free;
end;
end;
Line 8,397: Line 8,400:
for I := 0 to Length(aList) - 2 do
for I := 0 to Length(aList) - 2 do
Write(aList[I], ', ');
Write(aList[I], ', ');
WriteLn(aList[High(aList)]);
if aList <> nil then
WriteLn(aList[High(aList)]);
end;
end;
begin
begin