Control flow know how? please check the code


#1



puts "Text to search through: "
text = gets.chomp
puts "Word to redact: "
redact = gets.chomp

words = text.split(" ")

words.each do |word|
  if word === redacted
    print "REDACTED "
  else
    print word + " "
  end
end


#2

I am not an expert but i believe that your problem may be the extra = in your if block


#3

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