This was from the example given I didn't modify the code. It was the completed lesson program. But yes when I tried it over again this time with one word only and did work and showed the "REDACTED" an the array that it makes it into.
puts "Text to search through: "
text = gets.chomp
puts "Word to redact: "
redact = gets.chomp
words = text.split(" ")
words.each do |word|
if word != redact
print word + " "
print "REDACTED "
I also tried it, while accidently holding shift and got a different outcome also.
Text to search through:
Daniel is studying programming and information system security along with IoT.
Word to redact:
REDACTED is studying programming and information system security along with IoT. ["Daniel", "is", "studying", "programming", "and", "information", "system", "security", "along", "with", "IoT."]
and this gave me an error from code academy saying it was an infinite loop. I think I'm breaking something that I shouldn't be or just making it way harder on myself lol. thanks for the quick response.