On Tuesday 13 September 2005 07:06 am, Chris Game wrote: > leonardo.pires / gmail.com wrote: > > I think that's partially true. The curly form has a higher precedence > > then the do ... end one. So, I can code: > > > > def foo(duh) > > duh > > end > > > > def goo > > puts yield > > end > > > > foo goo { 'bar' } > > > > In this case, goo is a argument, right? > > So where does precedence come in? Maybe this will help (this is Hal Fulton's reply to me from about a month ago(August 19, 2005) (on the similar question): <quote> Re: Newbie question From: Hal Fulton <hal9000 / hypermetrics.com> To: ruby-talk / ruby-lang.org (ruby-talk ML) Date: Yesterday 11:13:45 pm (20050819) Randy Kramer wrote: > > I'm not clear on what binding tighter means, or to what--any further hints > appreciated. = What he means is, it's a matter of precedence. Observe the examples: = puts %w{cat bat rat}.map { |w| w.capitalize } puts %w{cat bat rat}.map do |w| w.capitalize end = They mean essentially the same as: = puts(%w{cat bat rat}.map { |w| w.capitalize }) puts(%w{cat bat rat}.map) do |w| w.capitalize end = In the second one, the map doesn't have a block associated with it -- the block is associated with the puts instead. The map with the empty block effectively does nothing, and the puts never calls the block given to it. </quote> Randy Kramer