5 Redacted exercise


Hey guys I am new to the community and would like some help if possible! For this exercise I feel like i got the code correct but I don't know why its giving me an error? This is the code that I run.

puts "Type something"
puts text = gets.chomp

puts "again"
puts redact = gets.chomp

words = text.split(" ")

words.each do |word|
if text == "yes"
    print "REDACTED "
else text == "huh?"
    print word + " "

And this is the error 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 it in all caps so I don't know what is the problem?


    if word != redact
        print word + " "
        print "REDACTED "


Thank you! but can you please help explain to me the why thats right?


text is the original input string. words is the array of words split out of text. word is the iterator variable in the the each do loop.