pleroma.debian.social

Cuddling elses or not?

Damien Conway's "perl best practices" recommends not to, because it would reduce visibility of the else block.

I vehemently disagree. Having an else block start on a line by itself makes it look like an unrelated statement, when in reality it is a continuation of the if block.

By cuddling your elses, you make it more clear that the block is part of a larger set of other blocks (if/elsif/else), rather than it being a block on its own.
replies
1
announces
0
likes
1

The if block is part of the context of the else block. You can't (usually) move the else block around without also moving the if block. Cuddling the else between the two brackets makes this more obvious and explicit.