thecodeboss logo

How Blocks Work in Ruby


Ruby has these things called “blocks,” and they’re one of the key things that make it different from most other programming languages. Often times they take the place of a callback, a lambda function, or even a loop - but they have their own ruby-specific uniquenesses too. In truth, they’re a pretty neat feature that make the language much more intuitive to use - especially for developers new to the language. What exactly is a block, how do you use it, and why would you use it? We’ll answer all these questions in this talk, as well as briefly review Ruby’s other “callable” structures, Lambdas and Procs.