From: DDENNISON@... Date: 2007-04-09T22:28:26+09:00 Subject: Re: code blocks and methods I like to think of code blocks as a visitor pattern or a callback function. You are essentially passing in a chunk of code to a method to be executed for each logical element of data. James Edward Gray II ruby-talk@ruby-lang.org (ruby-talk ML) 04/09/2007 07:46 cc AM Subject Re: code blocks and methods Please respond to ruby-talk@ruby-la ng.org On Apr 8, 2007, at 12:29 PM, botp wrote: > On 4/9/07, andy wrote: >> I am familiar with c# and java, one thing I don't understand is the >> difference between code blocks and methods, can anyone offer a better >> explanation than the one on the site above ? > > to quote carlson et al, "a Ruby code block is a method that has no > name." see http://www.devarticles.com/c/a/Ruby-on-Rails/Code-Blocks- > and-Iteration/ > or the ruby cookbook. I wrote about my take on code blocks for my blog a while back: http://blog.grayproductions.net/articles/2006/01/05/code-as-a-data-type James Edward Gray II . This message and any attachments contain information from Union Pacific which may be confidential and/or privileged. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited by law. If you receive this message in error, please contact the sender immediately and delete the message and any attachments.