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
if var == 10 print "Variable is 10" else print "Variable is something else" end
We can fix that with some
else magic! The above example just reminds you how an
else block works.
else statement inside your
ifthe current word equals the word to be redacted, then
print "REDACTED "with that extra space.
print word + " ".
The extra space in both cases prevents the words from running together.