This exercise DOES NOT WORK!


As you can see in the image. I have written code and It does not REDATE IT. so I copied the code from the beginning of this section to make sure if it works or not. It doesn't redate it. Why i dont know.

Futhermore, I write this code on my notepad app in mac save it with extension rb. Run this rb file in terminal and guess what the code fails.

Any one can explain why ?


Rather than having us type it all in, please post your raw code, and a link to the exact exercise so we can examine and test it. This will be helpful. Thank you.


You do not need to type my code. This is the exact code I copied from the starting of the session. Copy it and paste it in section 4/5 and test. it

puts "Text to search through: "
text = gets.chomp
puts "Word to redact: "
redact = gets.chomp

words = text.split(" ")

words.each do |word|
  if word != redact
    print word + " "
    print "REDACTED "


Thanks for quick reply.


Your code returns this SCT error:

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

The instructions only ask for that in this exercise.

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

There should be no if statement, yet. Furthermore, the code does work when there is only one term in the word. The reason yours was not redacted was because of the contained white space. Had the two words been side by side in the text, they would have been redacted as a single word.


Thank you, You have been a great help.
I was using multiple words when it is prompted for redate.
I have tried using single word and it worked.

About section of 4/5 I have changed but didnt bother to go back and fix it there.

Thank you