Why is this procedure not removing the stings 'cod' and 'bass' from the ItemList array like it should?
Simba Code:
procedure RemoveString;
var
i, j, c: integer;
ItemList, DropList, ItemsToKeep: TStringArray;
add: Boolean;
begin
ItemsToKeep := ['cod', 'bass'];
ItemList := ['shark', 'lobster', 'swordfish', 'cod', 'bass', 'mackerel',
'boots', 'gloves', 'seaweed', 'casket', 'oyster'];
c := 0;
SetLength(DropList, 11);
for i := 0 to High(ItemList) do
begin
add := false;
for j := 0 to High(ItemsToKeep) do
begin
if (ItemsToKeep[j] <> ItemList[i]) then
add := true;
end;
if (add = true) then
DropList[c] := ItemList[i];
inc(c)
end;
for i := 0 to High(DropList) do
writeln(DropList[i]);
end;
and of couse as soon as I post I figure it out. It's with the add true. Gotta figure out a way for it to check more than more string but not keep adding to the DropList