Mich
Mich

Reputation: 749

Ruby lambda literal syntax

I have a doubt on the lambda literal syntax corresponding to that (more classic) lambda syntax:

lambda { |foo| }

Is the following correct?

->(foo) {}

Thank you.

Upvotes: 27

Views: 10976

Answers (1)

Martin
Martin

Reputation: 7714

That is correct. More information about that in the official documentation: http://www.ruby-doc.org/core-2.1.1/doc/syntax/literals_rdoc.html#label-Procs

Upvotes: 18

Related Questions