Problem in procs


#1

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


#2

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.

https://www.codecademy.com/courses/ruby-beginner-en-L3ZCI/1/3