RosettaCodeData/Task/Search-a-list/Nanoquery/search-a-list.nanoquery
2023-07-01 13:44:08 -04:00

17 lines
438 B
Text

$haystack = list()
append $haystack "Zig" "Zag" "Wally" "Ronald" "Bush" "Krusty" "Charlie"
append $haystack "Bush" "Bozo"
$needles = list()
append $needles "Washington"
append $needles "Bush"
for ($i = 0) ($i < len($needles)) ($i = $i + 1)
$needle = $needles[$i]
try
// use array lookup syntax to get the index of the needle
println $haystack[$needle] + " " + $needle
catch
println $needle + " is not in haystack"
end
end for