Redacted 1. what we will be building


#1



redacted 1,as the example we seen, i am little bit confused


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

words = text.split(" ")

words.each do |word| #why this is word in the vertical line but not words, pls explain this to me
if word != redact #same here
print word + " " #same here
else
print "REDACTED "
end
end


Replace this line with your code.


#2

:confused:How are you confused? Your code is right.


#3

words (plural) is an iterable, an array. word is the block parameter, a singular value, one of the items in the iterable.


#4

It's right because it is the example from lesson 1.


#5

Ah right, thanks. I forgot that some lessons already have the code for you.


#6

A post was split to a new topic: Code doesn't work