RosettaCodeData/Task/Search-a-list/Elena/search-a-list.elena
2020-02-17 23:21:07 -08:00

21 lines
494 B
Text

import system'routines;
import extensions;
public program()
{
var haystack := new string[]::("Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty", "Charlie", "Bush", "Bozo");
new string[]::("Washington", "Bush").forEach:(needle)
{
var index := haystack.indexOfElement:needle;
if (index == -1)
{
console.printLine(needle," is not in haystack")
}
else
{
console.printLine(needle, " - ", index)
}
}
}