Ruby Recipes pp 103-118 | Cite as

Blocks and Iterators

  • Malay Mandal


Intuitively, a block of code is a set of statements that are grouped together. For instance, statements within a function (function body) or the block of code to be executed inside the while loop. However, Ruby has a special block feature that (while still being a group of one or more statements usually enclosed in flower brackets) has very interesting usages. It is especially useful in the context of iterator methods for collections.


Implicit Argument Block Feature Explicit Argument Block Parameter Collection Element 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Copyright information

© Malay Mandal 2016

Authors and Affiliations

  • Malay Mandal
    • 1
  1. 1.New South WalesAustralia

Personalised recommendations