Stuck on Redacted 5/6 - Control flow


Hi everyone,

I hate to be that person, but this is driving me nuts. I can't seem to get Part 5 - Control Flow quite right. Could someone please have a look at my code and let me know what I am doing wrong?

puts "Enter your sensitive text:"
text = gets.chomp
puts "Enter terms to redact:"
redaction_text = gets.chomp
words = text.split(" ")
words.each do |word|
    if word == redaction_text
        print "REDACTED "
        print word + " "

Thanks and regards to anyone who can assist.


This code works, I just tried it.
What kind of error are you getting? Perhaps it has to do with the browser you're using? It works on Chrome though.


Hey, thanks for checking this for me! I was using chrome. I have tried again just now, same code, and it went through fine, I'm, on to the next lesson. For reference, while I've forgotten the exact text, the error I was getting was the generic "your code is not working quite right" one for this lesson, telling me that the sensitive text needed to be replaced with "REDACTED " in all caps.


i get this message : 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 am using firefox :sweat:


never mind it fixed itself


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