Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Blocks in Ruby

To me Blocks concept in Ruby is quite new (having study C, Java). I want to know what kind of concept in classic Language can be similar to this new concept that makes me easily understand this term. Finding difficult to learn it, and want to know what scenario will this Blocks used in.

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Yeah, the concepts of Blocks, Procs and Lambdas in Ruby are not so easy to understand. They are similar to closures in some other (functional) languages. These resources might help you a bit:

http://rubylearning.com/satishtalim/ruby_blocks.html

http://ruby.about.com/od/beginningruby/a/blocks.htm

and these exercises:

http://www.codecademy.com/courses/ruby-beginner-en-L3ZCI/0/1?curriculum_id=5059f8619189a5000201fbcb

Thanks Maciej