Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Semicolons give me comfort

DZone's Guide to

Semicolons give me comfort

· Web Dev Zone ·
Free Resource

Deploying code to production can be filled with uncertainty. Reduce the risks, and deploy earlier and more often. Download this free guide to learn more. Brought to you in partnership with Rollbar.

The other day at work we had a discussion about how code should look, or rather, what characters to use.

It all started when I made the comment:

I like semicolons, they give me comfort


Immediately I had three Ruby on Rails developer laughing so hard tears would come out of their eyes. “Semicolons, such bullshit. Look how clean OUR code is” (Clean where? However, preprocessing code with no idea of the output is a topic for another day…). So, we talked about it in a more sensible manner, once everyone had calmed down, and it got me thinking.

Why do I feel comfort in semicolons? Should just line endings just be good for most purposes? Cleaner, less noise etc. I think it all stems from me doing JavaScript development for about 12 years now – semicolons is like a safety line, a way to control (or rather, not rely on) semicolon insertion in JavaScript. Also, with objects, multiline statements etc, it just feels good to have.

But from another point of view, I think for me it’s also about punctuation. No matter if some statement is one or several lines, no matter what characters it contain; when I see the semicolon I know that that specific statement is over. That gives me comfort.

Or do I just want Douglas Crockford to like me?

What are your thoughts on semicolons and how code should look like?

Deploying code to production can be filled with uncertainty. Reduce the risks, and deploy earlier and more often. Download this free guide to learn more. Brought to you in partnership with Rollbar.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}