From: Logan Capaldo Date: 2006-06-22T04:22:48+09:00 Subject: Re: The difference between s=s+”a” ans s<< ”a” On Jun 21, 2006, at 3:15 PM, Alan Moen wrote: > Hi, > > I wonder what is the difference between s=s+�a� ans s<< �a�? > > Somebody told me that s<< �a� concatenates the string without > mutation. > Is that right? > > Thanks, > Alan > > -- > Posted via http://www.ruby-forum.com/. > Someone told you wrong. s = s + "a" is concatenate s and "a" and return a new string, bind it to the variable a. s << "a" is append "a" to the string referenced by the variable s. It changes s in place. Of course, this is exactly the kind of question to be answered by ri. ri String#<< ri String#+