Redacted


#1

I am copletely stuck and I don't understand why this doesnt word:

puts "enter input"
text = gets.chomp
puts "enter input2"
redact = gets.chomp

words=text.split("")
words.each do |word|
If words == redact do
print "REDACTED "
else
print word + " "
end
end


#2

You should be checking if it is not equal to redact so change this operator == to != on this line and remove the do,


#3

The code after your if condition should be this one right here,

and your default condition should then return this,


#5

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