Blocks & Procs in Ruby

I have started learning Ruby, and I have read a couple of tutorials and I even bought a book ("Programming Ruby 1.9 - The Pragmatic Programmers' Guide"), and I came across something new that I haven't seen before in any of the other languages I know (I am working as a PHP webdeveloper).

Blocks & Procs. I think I understand what they are, but what I don't understand is why they are so great, and when and why I should use them. Everywhere I look they say blocks and procs are a great feature in Ruby, but I don't understand them.

Can anybody here give a total Ruby-newbie like me some explanations?

5
задан Nilks 24 August 2010 в 20:05
поделиться