Hi,
In message "Re: Array#count returning an enumerator"
on Thu, 10 Jan 2008 20:16:08 +0900, "David A. Black" <dblack / rubypal.com> writes:
|> ary.count.with_index{|x,i|...}
|
|What does that give you that's different from ary.each.with_index?
It returns count of items for which block gives true.
ary = [1,2,3,4]
p ary.count.with_index{|x,i| i%2 == 0} # => 2
p ary.each.with_index{|x,i| i%2 == 0} # => [1,2,3,4]
matz.