Redacted Advanced Challenge


#1


Redacted, Lesson Summary, Advanced Exercise: trying to create an input that allows user to redact multiple words using spaces between the words

My code below however simply prints out all the words. It doesn't redact ANY of them.


puts "Please enter some text, separated by spaces: "
text = gets.chomp.upcase
puts "What words above do you wish to redact, separated by spaces? "
redact = gets.chomp.upcase
words = text.split(" ")
redacted_words = text.split(" ")
words.each do |placeholder|
    if placeholder != redacted_words.each do |x| end
        print placeholder + " "
    else 
        print "REDACTED "
  end
end


#2

You want to compare one value to many, right? Does != do anything like that? != tests if the left and right side are not equal. one and many will never be equal to each other.