From: Randy Kramer Date: 2005-08-19T11:54:14+09:00 Subject: Re: Newbie question On Wednesday 17 August 2005 04:22 pm, James Edward Gray II wrote: > The difference is in binding. {...} binds tighter than do...end, so: Thanks! (I was sure I had read about some difference.) Thanks also for the example! (Which I'll have to think about a little ;-) I did put your examples (and some variants) in IRB and got the same results you did, but I don't really understand why. Without the puts, both produce the same result: irb(main):029:0> %w{cat bat rat}.map do |w| w.capitalize end => ["Cat", "Bat", "Rat"] irb(main):030:0> %w{cat bat rat}.map {|w| w.capitalize} => ["Cat", "Bat", "Rat"] I'm not clear on what binding tighter means, or to what--any further hints appreciated. Randy Kramer > irb(main):001:0> puts %w{cat bat rat}.map { |w| w.capitalize } > Cat > Bat > Rat > => nil > irb(main):002:0> puts %w{cat bat rat}.map do |w| > irb(main):003:1* w.capitalize > irb(main):004:1> end > cat > bat > rat > => nil > > Note how the block is associated with different methods here. Add > parenthesis as needed. > > James Edward Gray II