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

Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.

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?

What’s the best way to boost the efficiency of your product team and ship with confidence? Check out this ebook to learn how Sentry's real-time error monitoring helps developers stay in their workflow to fix bugs before the user even knows there’s a problem.

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 }}