My code looks perfect, but doesn't work


This is my code:
puts "Please give me text: "
text = gets.chomp
puts "Whattaya wanna redact: ?"
redact = gets.chomp

words = text.split(" ")

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

And my error message says: Oops, try again. It looks like you didn't print each word from the user's text to the console

Except...I do print every word, they show up.


And what is with the Instruction:

Add an if/else statement inside your .each
- 01. if the current word equals the word to be redacted, then print "REDACTED " with that extra space.
- 02. Otherwise (else), print word + " ".


Your code works just fine for me, assuming you don't have "This is my code:" written into your editor.


They're asking you to tell your code to do something with the split text using an if/else statement, saying 'If 'redact' is present, replace it with REDACTED, otherwise, print the word and re-add the space."


So in principal he should only have to do a refresh Browser ??

++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser


Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom