var haystack : array of String = ["Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"]; function Find(what : String) : Integer; begin Result := haystack.IndexOf(what); if Result < 0 then raise Exception.Create('not found'); end; PrintLn(Find("Ronald")); // 3 PrintLn(Find('McDonald')); // exception