17 lines
438 B
Text
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
|