DEV Community

Discussion on: Stuck while learning ruby on rails

Collapse
 
w3ndo profile image
Patrick Wendo

You need a second end.
Whenever you use the .each do, you essentially open a block of code. And all blocks need to be terminated with end.

So the correct version of the code would be

words.each do |word|
    if word == "redact"
       puts "REDACTED"
    else
      puts words + " "
    end
end
Enter fullscreen mode Exit fullscreen mode