From: Mischa Fierer Date: 2008-09-11T17:19:52+09:00 Subject: Re: Blocks and scoping question Stefano Crocco wrote: > On Thursday 11 September 2008, Mischa Fierer wrote: >> lambda {|x| puts x; [1,2].collect{|x| x+1}; puts x }.call("aaa") >> aaa >> 2 >> => nil >> >> Why is the final puts x not return a? > > Because puts always returns nil: > > ri IO#puts > > ---------------------------------------------------------------- IO#puts > ios.puts(obj, ...) => nil > ------------------------------------------------------------------------ > > Stefano Sorry, phrased this wrong, i wasn't looking at the return value, but the 2 above it. -- Posted via http://www.ruby-forum.com/.