Redacted #5 - I don't understand why this is working

I do not understand how this code is working, let alone how it passed. My word wasn’t actually redacted…
Can someone explain it to me?


puts "Enter some text: "
test = gets.chomp

puts "What to redact: "
redact = gets.chomp

words = test.split("")

words.each do |word|
if word != redact
print word + ’ ’
print “REDACTED”

<do not remove the three backticks above>

All kinds of stuff passes that the hard and fast rulebooks say should not. But, fortunately we’re not of the hard and fast. Lesson checkers can be finacky, especially if not completely thought out. Bear in mind that these early couses were largely written by members. They were not paid staff, to begin with. They just wrote usable courseware. CC engineers took one crack at fixing things and shut down the editor. Things are what they are now. As long as a learner can get past a lesson, there is nothing holding them back. Correct code also passes, albeit.

1 Like

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