RosettaCodeData/Task/Search-a-list/Sather/search-a-list.sa
Ingy döt Net 86c034bb8b new files
2013-04-10 12:38:42 -07:00

14 lines
414 B
Text

class MAIN is
main is
haystack :ARRAY{STR} := |"Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty", "Charlie", "Bush", "Bozo"|;
needles :ARRAY{STR} := | "Washington", "Bush" |;
loop needle ::= needles.elt!;
index ::= haystack.index_of(needle);
if index < 0 then
#OUT + needle + " is not in the haystack\n";
else
#OUT + index + " " + needle + "\n";
end;
end;
end;
end;