Write an .each loop that goes through words and just prints out each word it finds


getting error

Oops, try again. It looks like you didn't print each word from the user's text to the console.

Not understanding what I should be putting instead?

puts "He declares"
words.split ("He, declares")

puts "She declares"
words.split ("She, declares")

words.each {|s| print}


Maybe you´re an advanced student, I don´t get what you pretend to do with that | s |. What´s that supposed to print?

If it helps, I´m leaving my code here. In the .each loop, I order to print whatever is inside of the array "words".

puts "Write some text!"
text = gets.chomp
puts "Text to redact"
redact = gets.chomp

words = text.split(" ")

words.each do |word|
    print word


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