On Mon, Jan 21, 2013 at 6:12 AM, botp <[email protected]> wrote:
> On Mon, Jan 21, 2013 at 4:08 AM, David Richards <[email protected]>
> 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/
--
[email protected] |
https://groups.google.com/d/forum/ruby-talk-google?hl=en