I want to be able to this with a symbol
variable1 = :hello
variable2 = variable1.dup
but the dup method doesn’t work on symbols. Is there an equivalent method for symbols?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t, only one instance of a given symbol ever exists. It’s just as impossible as trying to do
42.dup.You can see that you always get the same object for a symbol with this simple snippet:
versus a string (which you can
dup):