M
Marco Guiseppe
Hello,
I've only been checking out Ruby for a couple of days, but today I came
across this problem.
If I do this:
#!/usr/bin/env ruby -w
string1 = "abc"
string2 = string1
string2.insert(-1, "def")
puts string1
puts string2
Then the result is:
abcdef
abcdef
How come string1 gets changed?!?
Thanks,
Marco
I've only been checking out Ruby for a couple of days, but today I came
across this problem.
If I do this:
#!/usr/bin/env ruby -w
string1 = "abc"
string2 = string1
string2.insert(-1, "def")
puts string1
puts string2
Then the result is:
abcdef
abcdef
How come string1 gets changed?!?
Thanks,
Marco