Problem in procs


Can anyone please explain uses of procs in ruby with example?


A proc is just a way to make a bit of code (a block) reusable instead of having to rewrite it every time. It also transforms your block into an object, which is more useful in a language where almost everything is object.

I think the lesson 8/21 Why procs? explains it well, with an example.