Thanks to everyone who tried to answer the question. None of you gave me the answer that I thought was necessary, but all of you made me think about how you do something in ruby mode (which was the highlight of this exercise!) And helped me come up with this answer:
I need to use the fact that iterators in Ruby are just methods. All methods return a value, and (oddly enough) eachreturn a useful value. If the iteration is complete, it returns the collection that you repeated; if you use breakto complete the iteration earlier, it returns nil(or an optional argument).
, true, , false, . ,
bar if array.each do |element|
if fooable(element) then
foo(element)
break
end
end