I dont understand whats wrong with my code


#1


https://www.codecademy.com/en/courses/ruby-beginner-en-mzrZ6/0/5?curriculum_id=5059f8619189a5000201fbcb#

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!).


puts"text"
text=gets.chomp

puts "words to redact"
redact=gets.chomp

words="lets make this work"
words=gets.chomp


words= text.split(" ")

words.each do |word|

if words != redact
  print "REDACTED "
else 
    print words + " "
    
    end
    end


#2

words.each do |word|

if words != redact
  print "REDACTED "
else 
    print words + " "

Problem's here.
You've said on line 1 that you want to single out word from words, which is right.

But then, you want to find if a specific word (singular) in the text matches the word to redact.
Singular is a keyword here.

Finally, != will never enable you to find a match for the word to redact.


#3

Can anyone help me? I am confused with the jekyll gem terminal.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.