I've been playing around with the code for this lesson but, for some reason, I can't seem to make the last 'if' statement call the second array that I've created from the two pieces of redacted text.
puts "Please enter your text here: "
text = gets.chomp
puts "Please enter a word to redact: "
redact = gets.chomp
puts "Would you like to enter another word to redact? (yes/no)"
ans = gets.chomp
if ans == "yes"
puts "Please enter your second word to redact: "
redact2 = gets.chomp
puts "Fair enough..."
words = text.split(" ")
redacts = [redact,redact2]
words.each do |word|
if word != redacts
print word + " "
print "REDACTED "
Just what is it that I'm doing wrong, here? Is it something to do with how I'm referencing the second array? Is that not possible within an 'if' statement?