Good! There were two problems with our output, though: we didn't have spaces between our words, and our program didn't actually replace the word we wanted to redact with the word "REDACTED".
if var == 10
print "Variable is 10"
print "Variable is something else"
We can fix that with some if/else magic! The above example just
My Code is:
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 + " "
WHAT did i do wrong keep on saying
Oops, try again. Make sure to print each word from the user's text to the console unless that word is the word to be redacted; if it is, print REDACTED (all caps!).