Blocks (2)

One of the previous post is about “Ruby Blocks” this post will have all the information on that post plus more, this post will be a quick reference about the basics of the blocks, and how to use them. for other resources on blocks you can see the Ruby-Ironman link


Example of a Block

Passing Parameters to Blocks

Blocks Return Values

Blocks can work the parameters passed, and also can return values, by default a block will return the last line on the block see example:

Passing a “BLOCK” as a parameter to a “METHOD”

 

 

 



Copyright 2017. All rights reserved.

Posted January 7, 2017 by Edmundo in category "Ruby