My code goes through but wont redact


My code below goes through, but wont redact. Instead of redacting, the word for redact disappears from the output- eg: Cake is ["Cake", "is", "good"]. Good is the word that supposed to redact. Can some advice please.

puts "this is the first sentence "
text = gets.chomp

puts "second test "
redact = gets.chomp

words=text.split (" ")

words.each do |words|
if words == redact
print = "REDACTED "
print words + " "


As your are using the equal-sign =
in your
print = "REDACTED "
you are assigning the string "REDACTED " to print
and thus not actually printing....


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