Looks like you didn’t print each word



Having some issues section 4 of Redacted. I’ve attached my code below, and it outputs exactly as it should, however I get:

“It looks like you didn’t print each word from the user’s text to the console.”

Kind of stumped here, it seems to be printing it all… Any ideas? Cheers.

puts "give"
text = gets.chomp
words = text.split(" ")

puts "censor"
redact = gets.chomp

words.each do |i|
  print i + " "


If the word matches the censor word, then we are to print `REDACTED ’ in its place.


That doesn’t appear to be in the instructions. All it says is:

Let’s start simple: write an .each loop that iterates through words and just prints out each word it finds.”


Okay, we’re still in the set up…

For this step try just puts in your loop with no added white space.

puts i


Sure, that was actually my original loop but I think I had it in the wrong part of the code. So I put it at the end where my current loop is:

words.each do |i|
  print i

Seems to have done it. Appreciate the help!