Stuck on Redacted! 5/6 I read the other thread and am still stuck


#1




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!).

Every word is redacted, not just the one I selected


puts "What is the text we will be evaluating? "
text = gets.chomp
puts "What word should we redact? "
redact = gets.chomp

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


#2

if word = redact should be if word == redact


#3

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