3 ms·
Here's a better explanation for #1: In Ruby, most classes (including String) are reference types. This is why `str2 = str` doesn't create a new string. It does
by charliesome 15y ago
Here's a better explanation for #1:
In Ruby, most classes (including String) are reference types. This is why `str2 = str` doesn't create a new string. It doesn't create a new RString either - str and str2 are both pointers to the same RString struct.