Whats wrong with my code 6/5


speed dial to the lesson

I’VE been stock on the lesson for few days and can’t figure out what is going on.
The error comment I receive is "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!).
My code as follow:

puts "Enter some text: "
text = gets.chomp

puts "Enter words to redact: "
redact = gets.chomp

words = text.split(" ")
words.each do |x|
if x == redact
print "REDACTED"
print x + ""

Please help me figure out my problem.
Thank you


Please remember to post a link to the exercise. We do not have them on speeddial. Also include any error messages (SCT and/or console). Thanks.


Hello mtf,
I have updated my post.


One thing that jumps out is the missing space character:



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.