I almost never use the then keyword. However, there is one case where I believe that it significantly improves readability. Consider the following conditional conditional if statements.
Example A
if customer.jobs.present? && customer.jobs.last.date.present? && (Date.today - customer.jobs.last.date) <= 90 puts 'Customer had a job recently' end
The line length is too long. Hard to read.
Example B
if customer.jobs.present? && customer.jobs.last.date.present? && (Date.today - customer.jobs.last.date) <= 90 puts 'Customer had a job recently' end
Where conditions end and where the internal code begins. Following the instructions of the Ruby Style Guides, you should have one extra space for segments for multi-line conditional expressions, but I still don't find it easy to read.
Example C
if customer.jobs.present? && customer.jobs.last.date.present? && (Date.today - customer.jobs.last.date) <= 90 then puts 'Customer had a job recently' end
For me, the C example is by far the clearest. And using the then tag does the trick.
Andrew Griffith
source share