16 Mar '14, 6am

@jasim_ab found an ambiguous mention of whether or nt blocks r objects comparin with pls chk..

A lambda is a piece of code that you can store in a variable, and is an object. The simplest explanation for a block is that it is a piece of code that can't be stored in a variable and isn't an object. It is, as a consequence, significantly faster than a lambda, but not as versatile and also one of the rare instances where Ruby's "everything is an object" rule is broken. As with most things in programming, there is more to this story, but blocks are an advanced topic so lets keep things simple for now. If you're interested in studying blocks in more detail, take a look at our chapter on blocks in our book "Ruby Primer: Ascent " which addresses intermediate and advanced topics. Let's look at an example of a block that does the same thing as the lambda you wrote in the previous exercise. Example Code: def demonstrate_block(number) yield(number) end puts demonstrate_block(1)...

Full article: http://rubymonk.com/learning/books/1/chapters/34-lambdas-...

Tweets

@jasim_ab found an ambiguous mention of whether...

rubymonk.com 16 Mar '14, 6am

Blocks are often the first Ruby-ism that new Rubyists run into, and are confused by. What are blocks? Why do they exist? H...

Why do you like Ruby?

rubyflow.com 17 Mar '14, 5pm

Why do you like Ruby? Posted by timmillwood on March 17, 2014 — 0 comments While we work on client projects, personal proj...

Back to Basics: Polymorphism and Ruby

robots.thoughtbot.com 14 Mar '14, 10pm

Back to Basics: Polymorphism and Ruby Britt Ballard March 14, 2014 ruby Polymorphism - the provision of a single interface...

Green News: N.H. Town Blocks Big Wind

Green News: N.H. Town Blocks Big Wind

greenbuildingadvisor.com 17 Mar '14, 9am

Danbury, N.H., residents have voted in favor of four local ordinances that will make it tough to develop large scale wind ...

Back to Basics: Polymorphism and Ruby

rubyflow.com 14 Mar '14, 10pm

Polymorphism is one of the fundamental features of object oriented programming, but what exactly does it mean? At its core...

Reasons to learn Ruby on Rails "1: Why You Shou...

buildingwebapps.com 14 Mar '14, 11pm

Based on the professional and balanced commentary in the first episode, I'm looking forward to the rest. One tip: your les...