Redacted 5/6 help please


#1



what am I doing wrong?


puts "what are you looking for?"
text=gets.chomp

puts "word to be REDACTED?"
redact=gets.chomp

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


#2

Oops, try again. Make sure to print each word from the user's text to the console unless that word is the word to be redacted; if it is, print REDACTED (all caps!).

this is the error I'm getting


#3

We cannot use the same variable to act as a single item (block variable) when the variable points to a reference object, such as an array.

words.each do |word|

end

plural.each do |singular|

end

Remember to attach trailing space... "REDACTED ".


#4

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