What is their parser complaining about ?!


#1

my code:

puts "give me some text"
text = gets.chomp!
puts "what redacter?"
redact = gets.chomp!
print redact + "\n"
words = text.split(" ")
words.each do |word|
    if word == "redact"
        print "REDACTED"
    else
        print word + " "
    end
end

the output makes me think it should work, but the check for redact fails

give me some text
 bb sue bb
what redacter?
 sue
sue
bbsuebb["bb", "sue", "bb"]

#2

Hi @pseudosasa,

Hint: In this line,

if word == "redact"

you are comparing word to a constant string, you might want to use some input variable instead :wink:


#3

you are right, it was staring me in the face.:slightly_smiling: