Redacted 1. what we will be building


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
print "REDACTED "

Replace this line with your code.


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


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


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


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


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