Redacted! 5,


my code isn't working!
have looked at other posts and mine is the same word for word!

puts "words to evaluate"
text = gets.chomp

puts "words to redact"
redact = gets.chomp

words = text.split(" ")

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


Perhaps considering what it does differently from what you want says something about which part of the code is responsible for this wrongness?


it seems to do what it is meant too?


So it's not wrong?

You just said.. I'm confused.


it wont let me pass this section still, it says it is wrong but it wont say where, and as far as i can see it prints what it should. so maybe i am not clear on this bit? what it should print


Does it just say "wrong" or does it say in what way it's wrong?
It can't possibly say where, but it can say what behaviour wasn't correct and you can use that to figure out where it is by considering where in the code you wrote that behaviour


Let's run it then. If it's mysteriously not passing, then testing it a bit seems like the sensible thing to do next.

words to evaluate
hello there bob how are you bob
words to redact

The word to redact was bob and there are two bobs, so REDACTED should be used twice in the places where bob was, while leaving the rest of the text intact. That's not quite what happened though, so that's probably why it won't let you pass.


ah yes thank you. i will see if i can change that


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