4. Redacted! Lesson
Earlier, I had some problems creating the code for this, but that's been solved after having a peak at another person's variation of this.
It seemingly behaves how I want it to. It's just not redacting the word I want it to redact multiple times. It stops redacting after the first word that needs to be redacted.
I know, i'm missing a string of code, but I don't know what. Can someone help me with this?
puts "Text to search through : " text = gets.chomp puts "Words to redact : " redact = gets.chomp words = text.split(" ") words.each do |word| if word != redact print word + " " else print "REDACTED" end end Replace this line with your code.