Converting between symbols and strings question


#1



strings = ["HTML", "CSS", "JavaScript", "Python", "Ruby"]
# Add your code below!
symbols = []
strings.each do |s|
    s.to_sym
    symbols.push(s)   
end
print symbols

It prints : ["HTML", "CSS", "JavaScript", "Python", "Ruby"]nil
BUT the error occurs : Oops, try again. It looks like HTML isn't a symbol
What i should do for completing this task


#2

Delete the code of your 3rd line.

Then include your 5th line of code to your 6th one so that it is symbols.push(s.to_sym)

Last but not least delete your print statement.


#3

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

symbols =[]
strings.each do |x|
symbols.push(x.to_sym)
end
symbols


#4

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