9 Converting Between Symbols and Strings


#1

Please Help Me.

Why does it not working?

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

symbols = []

strings.each do |x|
if x.include?("s")
"s".to_sym
symbols.push(x)
end
end

print symbols`


#2

If you lookat earlier posts you'll see you're not the only one to misinterpret the instructions! (I did too).
It's asking you to turn each string in the array into a symbol, not search for the letter s in the strings.
"s" in this case is what they're suggesting for a place holder, so it should be:
strings.each do |s|
symbols.push(s.to_sym)
end

That's the neatest way I found of doing it!
Hope that helps clarify!


#7

A post was split to a new topic: Is it possible to write the action in two steps


#8