2006/3/12, Mc Osten <riko / despammed.com>:
>
> I noticed that strings are mutable in ruby since << adds to existing
> string. But I found out sometimes += creates a new string objetc...
>

a += b is the same as a = a + b. So, (a + b) creates a new string, and
then assigns it to a. If you did a = b + c, you would not expect b to
change, and so it is the same with a += b.

Douglas