Confused about how to convert strings to hashes, asking for help


#1



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


The method .to_sym doesn't appear to work for me. I even checked the glossary first and the ruby-doc.org first to find proper syntax, but i can't figure it out. I've tried dozens of different syntax and I can't seem to get the string to convert into symbols let alone getting the new symbols into the new array.


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

strings.each do |x|
  print x.to_sym 
end


#2

Rather than print, use Ruby's array.push() method to append these to the symbols array.


#3

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