Redacted


#1

Hi, wondering if someone could take a look at something for me?

I'm on quite an early stage of the Redacted course, with the following instructions.

'Let's start simple: write an .each loop that goes through words and just prints out each word it finds.'

I have the following code, which gives the right output, however Ruby is giving me the following error

'Oops, try again. It looks like you didn't print each word from the user's text to the console.'

Can anyone see where I am going wrong?

puts "Text to search through: "
text = gets.chomp
puts "Word to redact: "
redact = gets.chomp

words = text.split(" ")

words.each do |word|
if word != text
print word + " "
end
end


#2

It probably doesn't like the spaces that you're adding

Also, comparing word to text doesn't seem useful.