A
Alex DeCaria
I am confused by the use of the delete! method as applied to a string.
In IRB if I type
foo = "hello"
bar = foo
foo.delete!("h")
then both foo and bar become "ello". How come bar isn't independent of
foo in this case?
If I then type
foo = foo + "oo"
then only foo becomes "ellooo" while bar remains "ello"
Why is bar independent of foo in the second case, but not the first?
Thanks,
Alex
In IRB if I type
foo = "hello"
bar = foo
foo.delete!("h")
then both foo and bar become "ello". How come bar isn't independent of
foo in this case?
If I then type
foo = foo + "oo"
then only foo becomes "ellooo" while bar remains "ello"
Why is bar independent of foo in the second case, but not the first?
Thanks,
Alex