In Ruby, how can I copy a variable such that changes to the original don\'t affect the copy?
For example:
phrase1 = \"Hello Jim\" phrase2 = phrase1 p
Using your example, instead of:
phrase2 = phrase1
Try:
phrase2 = phrase1.dup