If the array indexes are causing you headaches, you might want to consider using the constructs low and high.
for i := arteller downto low(arBestanden) do
or
For i := low(arBestanden) to High(arbestanden)
Because you use a separate index, something like thing might be helpful as well:
Type
arBestandenRange = 1..250;
var
arTeller: arBestandenRange;
arBestanden : array[arBestandenRange] of string;
i : arBestandenRange;
begin
if arteller >= low(arBestanden) then
begin
for i := arteller downto low(arBestanden) do
begin
deletefile(arBestanden[i]);
arteller := arteller -1;
end;
end;
end;
Or what would be my favourite:
Type
arBestandenRange = 1..250;
var
arTeller: arBestandenRange;
arBestanden : array[arBestandenRange] of string;
begin
while arTeller > low(arBestanden) do
begin
dec(arteller);
deletefile(arBestanden[arTeller]);
end;
end;
The range takes the headaches away because when you "out of range" the compiler will tell so, as well as runtime (when enabled).