Hi,

(11/11/28 10:05), Rodrigo Rosenfeld Rosas wrote:
>> &expr calls #to_proc method on the result of expr, to achieve a Proc object.

achieve a Proc object, and convert it into a block.

> Anyway, I still didn't understand why (1..10).grep(&:even?) works, but (1..10).grep(&:even?){|i| i+1} not.

The former is equivalent to

  (1..10).grep {|i| i.even?}

You can't pass two or more blocks to one method call.

> Actually, I didn't understand your explanation. You said that &expr calls #to_proc on the result of expr. What is the expr on each example? Is there any place I could further read about those differences?

expr is :even? symbol literal here.

-- 
Nobu Nakada