inessential by Brent Simmons

The Case Against } else {

Sometimes I see code like this:

if {
    …stuff…
} else {
    …other stuff…
}

That’s pretty much a-okay with me.

Pretty much. Until I want to comment-out the else block. There’s no way to do a line-wise selection and hit cmd-/ (when it works) and comment out just the else block.

Update 3:15 pm: Dan McTough reminds me that there is a way to do this. My objection is that it’s more difficult and requires more paying-attention. It’s easier to go to the start of a block and select to the end — it requires almost no thought.

Also: many people like } else { on the ground that it makes it easier to notice the else. Okay.