On Tue, Mar 25, 2003 at 04:44:14AM +0900, dblack / superlink.net wrote:
> > puts (3).to_s + 'b'    # => 3
> 
> This calls puts(3), the return value of which is nil.  nil.to_s is "",
> which gets added to 'b'.  You haven't asked it to print that result,
> so it just gets discarded.  (But that's why you get "b" as the
> expression's value when you do the same expression in irb.)

Incidentally, you get warnings with '-w':

x.rb:2: warning: puts (...) interpreted as method call
x.rb:2: warning: useless use of + in void context

It should be compulsory to run with '-w' turned on :-)

Regards,

Brian.