Lesson 9/15 - Converting Between Symbols and Strings


#1

A different solution to the exercise, as i had initially misunderstood it. Thought we were asked to only convert the strings containing the letter ā€œsā€ :stuck_out_tongue:

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

# Add your code below!
symbols = []

strings.each do |s|
 s.downcase!
  if s.include? "s"
    symbols.push(s.to_sym)
  elsif
    s.include? "ss"
    symbols.push(s.to_sym)
  end
end

puts symbols

#2

could you share the url of this exercise? Makes for easy access to the lesson so we can debug in the lesson


#3

I misunderstood the nomenclature of the ā€œsā€ iteration. I initially thought the exercise was asking me to iterate the array for ONLY the strings that would contain the letter ā€œsā€. I have now realized that ā€œsā€ was just a name. Sorry and thanks!


#4

so you only has to push s variable (loop iterator) to array, that is a lot easier indeed