Blocks are code contained within the braces that if used with the last post’s example would be associated with the call to the function threeTimes. Within the defined method a call for yield is called three times in a row wherein each time a call to the block is sent the greeting is displayed which in this case is three times. Blocks are interesting for they can be passed on to and received from, values that have been processed by another function. The next example would have the block display the values of the Fibonacci Series of numbers to a set number of times that we will set. The Next Post would show an example of this using a block to return the values.
-
Pages
-
Categories
-
Archives
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
