I am learning Ruby on RubyMonk. And I cannot perform this lesson:
We have a method called
filter that accepts an explicitly passed block. We look to the block to tell us whether a value from the array should be accepted or rejected.
Array#select method does exactly this but requires an implicit block. Try converting the explicit block into an implicit block and passing it on to
def filter(array, block)
return array.select # Your code here
What I should do?
def filter(array, block) return array.select(&block) end
Note that the answers for each problem are accessible from the page. Simply click the link titled "See the Solution"