var haystack =%w(ZigZagWallyRonaldBushKrustyCharlieBushBozo)%w(BushWashington).each { |needle| var i = haystack.first_index{|item| item == needle}if (i >=0) { say "#{i}#{needle}" } else { die "#{needle} is not in haystack" }}
Output:
4 Bush
Washington is not in haystack at find.sf line 9.
Extra credit:
var haystack =%w(ZigZagWallyRonaldBushKrustyCharlieBushBozo)say haystack.last_index{|item| item =="Bush"}