well, for those lazy people who dont want to use a certain type of InBlankArr(), here :p
Rounds two: THanks to Naum :)
SCAR Code:function InArrEx(Arr: TVariantArray; Any: Variant; Var Place : Integer): Boolean;
var
i: Integer;
begin
for i := 0 to high(Arr) do
try
result := Arr[i] = Any;
if result then
begin
Place := I;
Exit;
end;
except
end;
end;
Function InArr(Arr: TVariantArray; Any: Variant): Boolean;
var
spot: Integer;
begin
result := InArrEx(Arr, Any, spot);
end;
Original:
SCAR Code:function InArr(Arr: TVariantArray; Any: Variant): Boolean;
var
i: Integer;
begin
for i := 0 to high(Arr) do
try
result := Arr[i] = Any;
if result then exit;
except
end;
end;
I was reading Naums tut and thought "Oh no one has made just a general 'InArr'?"
So I thought I'd try :D
Took about two minutes.
Example : writeln(InArr(['wat', 2, 'haf', 244, true], 2));

