[Solved] reconstructing lost code (InArray) – cont [closed]


Most likely, the function tests if n belongs to the array:

function InArray(A: TIntArray; n: Integer): boolean;
var
  i: integer;
begin
  result := false;
  for i := low(A) to high(A) do
    if A[i] = n then
      Exit(true);
end;

If you are using an old version of Delphi (<2009), you have to do

function InArray(A: TIntArray; n: Integer): boolean;
var
  i: integer;
begin
  result := false;
  for i := low(A) to high(A) do
    if A[i] = n then
    begin
      result := true;
      break;
    end;
end;

instead.

25

solved reconstructing lost code (InArray) – cont [closed]