From: Robert Klemme Date: 2013-01-21T16:00:38+09:00 Subject: Re: question about string concatenation On Mon, Jan 21, 2013 at 6:12 AM, botp wrote: > On Mon, Jan 21, 2013 at 4:08 AM, David Richards > wrote: >> >> I'm puzzled about why the following happens (I'm using v1.9.3): >> >> s = "[" 9.to_s "]" # error >> >> These other two concatenation constructs appear to work fine: >> >> s = "[" + 9.to_s + "]" >> s = "[" << 9.to_s << "]" > > > just make your expression string friendly, eg > > "[" "#{9.to_s}" "]" > => "[9]" You do not need .to_s inside string interpolation. But what is the point in suggesting that over this solution? s = "[#{9}]" Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/