"Hashes and Symbols": "Converting Between Symbols and Strings" error


#1

https://www.codecademy.com/courses/ruby-beginner-en-Qn7Qw/1/4

It says this in the console:

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

and Codecademy says this:

Here is my code:

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

# Add your code below!
symbols=[]
strings.each do |s| 
s.to_sym
symbols.push(s)
end

What's wrong with it?


#2

We cannot convert in place. The thing to do in this case is push the expression to the array

symbols.push(s.to_sym)

You can add this to your code and still pass:

symbols.each {|x| puts x }

Output:

HTML
CSS
JavaScript
Python
Ruby
[:HTML, :CSS, :JavaScript, :Python, :Ruby]

#3

@mtf
I see,

I don't see how this code works for passing the lesson.


#4

It has no bearing on the lesson, as such, and is ignored by the lesson checker. I added it so you could see what the new array looks like.