< Ayo Membuat Program Pascal

type

  TArrString = array of string;

function CariLinier(var Arr: TArrString; Cari: string): LongInt; var

  Idx, Batas, Ketemu: LongInt;

begin

  Idx:= Low(Arr); 
  Batas:= High(Arr); 
  Ketemu:= -1;
  while (Idx <= Batas) and (Ketemu = -1) do begin
     if Arr[Idx] = Cari then Ketemu:= Idx; 
     Inc(Idx);
  end;
  CariLinier:= Ketemu;

end;

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.