From: Tim Hunter Date: 2008-02-20T08:45:48+09:00 Subject: Re: String Concatenation and Implicit Object Creation pachl wrote: > Do adjacent strings or strings separated by backslash and a newline > create multiple String objects? > > For example: > > s1 = 'asdf' 'qwer' > > s2 = 'asdf'\ > 'qwer' > > I don't know how to figure this out, but I ran benchmarks and compared > against '<<' and '+' and it looks like each example above only creates > a single String object. What's really happening? > > -pachl > The string concatenation method is "+" s1 = "asdf" + "qwer" This creates 3 string objects, "asdf", "qwer", and "asdfqwer". -- RMagick: http://rmagick.rubyforge.org/ RMagick 2: http://rmagick.rubyforge.org/rmagick2.html