ThoML
1/30/2008 2:00:00 PM
> it's supposed to run until it finds an element of the array that isnt
> blank and then stop.
And then do what? Do you need the index? In this case you can use the
index method.
a = [1,2,nil,3]
a.index(nil)
# => 2
or do you want the elements before that? Or ...
Anyway, another solution close in resemblance to yours could be:
for e in a
break if e.nil?
do_something e
end
HTH,
Thomas.