12 lines
330 B
Plaintext
12 lines
330 B
Plaintext
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
|