Why doesnt my method works?


#1



https://www.codecademy.com/en/courses/ruby-beginner-en-Qn7Qw/1/4?curriculum_id=5059f8619189a5000201fbcb


Why doesn't my method work ? Error as follows undefined method `to_sym!' for "HTML":String


strings = ["HTML", "CSS", "JavaScript", "Python", "Ruby"]

# Add your code below!
symbols = []

strings.each do |string|               
    string.to_sym!
    symbols.push(string)
end


#2

That's not quite the right method name (and it would be very confusing if a string suddenly turned into a symbol, which is probably why that function doesn't exist and/or that it isn't even possible)

Instead one would want to create a symbol from what's in the string. What's the method name for that? (slightly different)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.