From: Jesse Merriman Date: 2007-05-02T12:04:20+09:00 Subject: Re: strangeness with string concatenation and function return values On Tuesday 01 May 2007 22:27, Mike Steiner wrote: > I get an error when running code snippet A, but if I change it to B, there's > no error. I'm not familiar enough with Ruby to know why this is. Could > someone explain this? > > ----- A ----- > def ReturnString ( ) > return "abc" > end > > File.open ( "junk.txt" , "w" ) do | f | > f.write ( ReturnString ( ) + "\n" ) > end You can't have that space between ReturnString and the parenthesis (you sure like lots of spaces, eh?). Here's one way of doing it that should work: def return_string 'abc' end File.open('junk.txt', 'w') do |f| f.puts return_string end -- Jesse Merriman jessemerriman@warpmail.net http://www.jessemerriman.com/