I have a couple of questions


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

words = text.split(" ")

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

the code above is the intro to this lesson
i had a couple of questions.

  1. at the top (text=gets.chomp) does the computer automaticaly know to do this action on the answer the user gives us???


Gets allows you to get a response, and chomp bites off excess space. I don't understand your question.


ok. i also didnt understand line 5

words = text.split(" ")


It splits it into individual characters to be checked for redacting.


so line 9? does what?


It sees if the word is not equal to the redacted word.


sorry i meant the 10th line


That prints the word with a space, so that the words aren't jumbled together.


great i think i get it now. thanx!