Converting symbols and strings/lesson 9


#1

I am a bit lost. Is |s| standing for each String in the Strings array? or are we singling out the words with s? I'm familiar with where i should be headed, but not sure how to get there.

Oops, try again. It looks like you are not adding each symbolized string to the strings array!

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

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

#2

It's an interesting puzzle! I tried way too complicated stuff.
Having exhausted my creativity on this one, I tried to make it as simple as possible, and it worked. If I could give you just a hint I would have, sorry for giving the answer straight away. Study it, try to recreate it.

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

strings.each do |s|
symbols.push(s.to_sym)
end


#3

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

Add your code below!

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

print symbols


above code works


#4

|s| is a generic representation of each element in your array.

you don't need an if/end statement for this questions. Try combining symbols.push with your s.to_sym.


#5

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

simplified method


#6

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