Elliott C. Back: Technology FTW!

Perl Style: The If / Else Statement

Posted in Code, Cute by Elliott Back on September 6th, 2006.

While reading Perl Best Practices I can across a section which began:

Don’t cuddle an else

It turns out that a cuddled else looks like

} else {

while the uncuddled else places the else on a new line

}
else {

However, I can’t agree. The way I see it, not merging the else and the closing brace of the if statement simply wastes space. And, it doesn’t hurt alignment because you can still follow the else block–it’s just two positions off what it would have been otherwise. What do you think?

This entry was posted on Wednesday, September 6th, 2006 at 10:34 pm and is tagged with alignment, best practices. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

Viewing 6 Comments

 

Trackbacks

(Trackback URL)

close Reblog this comment
blog comments powered by Disqus