Looks like you didn’t print each word


#1

https://www.codecademy.com/courses/learn-ruby/lessons/redacted/exercises/redacted

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 + " "
end


#2

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


#3

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

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


#4

Okay, we’re still in the set up…

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

puts i

#5

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
end

Seems to have done it. Appreciate the help!


#9