I'm having trouble with my code


#1

Here's my code:

puts "User input"
text = gets.chomp
puts "User input"
redact = gets.chomp

words = text.split(" ")

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

I've tried this multiple ways, including using the syntax from a different topic related to this same exercise. No matter how I code this, I still get the following error message:
" Oops, try again. It looks like you didn't print each word from the user's text to the console."

Please help me. What am I doing wrong?


#2

mine says incorrect syntax. here is code:

puts "Hello there. What paragraph would you like to redact?"
text = gets.chomp
puts "What word am I going to redact for you?"
redact = gets.chomp
words = text.split(" ")
words.each do |word|
if word == redact
then print "REDACTED "
else print word + " "
print words
end


#3

I got the code correct and even the correct syntax
:
puts "Input, please"
text = gets.chomp
puts "What do i need to redact"
redact = gets.chomp
words= text.split(" ")
words.each do |letter|
if letter == redact
print "REDACTED "
else
print letter + " "
end
end


#4

Did you still have a problem, or did this code and syntax work for you?