Redacted! lesson. I'm doing something wrong and I'm not sure what


#1

puts "This is what you're looking for: "
text=gets.chomp

puts "Redacted: "
text=gets.chomp

words=text.split(" ")
words=['bus', 'hand']
words.each do |word|
print word
if word " "
print "REDACTED"
else
print word + " "
end
end

It allowed me to move on, but the code in action won't actually redact anything I've inputted.

It gives me this error

busundefined method `word' for #


#2

Use a different variable for each input.

This line should be removed.

if word == redact      # or whatever variable you choose to use
    print "REDACTED "  # be sure to include a space character

#3

This helped me understand it a bit better.

Still not very intuitive.


#4

As long as YOU found the solution, and didn't take home a grab bag.


#5

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