No matter what i try it wont work


this is my code for the redacted problem I've been through the forums and nothing seems to help it keeps telling me "Oops, try again. Make sure to print each word from the user's text to the console unless that word is the word to be redacted; if it is, print REDACTED (all caps!)."

I have no idea what this means or how to fix it please help.

puts "please input text"

puts "Which words shall we redact"

words=text.split (" ")

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

    puts word + " "



You can start by comparing your output to the described output, the difference might say something about which part of your code isn't doing it's job.


Well, one issue is that you have the code reversed: if word DOES NOT EQUAL redacted, then it should print the word. The way you have it, if the word is not redacted, you are asking the code to print the word "redacted" which is not what you intend.

Does that help at all?