From: botp Date: 2013-01-21T14:12:41+09:00 Subject: Re: question about string concatenation --047d7b6d85bc8d16bf04d3c582ef Content-Type: text/plain; charset=UTF-8 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]" best regards -botp --047d7b6d85bc8d16bf04d3c582ef Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Jan 21, 2013 at 4:08 AM, David Richards <lists@ruby-forum.com> wrote:
I'm puzzled about why the following happens (I'm using v1.9.3):

s =3D "[" 9.to_s "]" =C2=A0# error

These other two concatenation constructs appear to work fine:

s =3D "[" + 9.to_s + "]"
s =3D "[" << 9.to_s << "]"
<= div>
just make your expression string friendly, eg
=
"[" "#{9.to_s}" "]"
=3D>= "[9]"

best regards -botp
=C2=A0
--047d7b6d85bc8d16bf04d3c582ef--