From: "David A. Black" Date: 2008-07-16T21:34:34+09:00 Subject: Re: New to Ruby. Specific syntax question. Hi -- On Wed, 16 Jul 2008, Cole Mister wrote: > > take an example: >> def fib_up_to(max) >> .... >> yield t >> ... >> end >> >> fib_up_to(1000) {|f| print f} >> >> the f in block is the t in each step > > Okay. That makes sense. > > The block is pretty much defining the yield statement? > > It'll make more and more sense the farther I get into the book I hope. The block is a snippet of executable code. The yield command executes it; in other words, by supplying the code block, you're giving the method some code that it can execute. You call the method, and the method calls you back :-) David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails July 21-24 Edison, NJ Advancing With Rails August 18-21 Edison, NJ See http://www.rubypal.com for details and updates!