Chad Perrin: SOB

30 December 2006

cursquaround parenthebrackaces

Filed under: Geek — apotheon @ 03:07

I keep seeing some oddly varied and contradictory terms used to describe paired delimiter characters used in programming. Specifically, I see a lot of people using incorrect terms to refer to braces, brackets, and parentheses.

Sometimes, I hear people refer to “square brackets” and “curly braces”, which is fine, if a bit clumsy and redundant. At least they’re applying the correct terms to the correct delimiters. What really gets my goat, though, is when someone uses one term for everything — like “round brackets”, “square brackets”, and “curly brackets”. Once or twice, I’ve even seen people obstinately arrange to use the wrong terms for everything, all at once. An example that leaps to mind is a paragraph I came across one day on the Internet where someone referred to round brackets, curly brackets, and square braces. Como se huh? WTF, mate?

I say again, Whiskey Tango Foxtrot, over.

For those few of you programmatically inclined netizens who actually read my words here from time to time, here’s a quick and handy guide:

Parentheses are those curved things above the 9 and 0 keys on an American English qwerty keyboard layout. This is an open parenthesis: (

This is a closing parenthesis: )

Those are not frowny and smiley faces.

Brackets are those things made up of straight lines and corners that, on American English qwerty keyboards, are the next two keys to the right of the P key. This is an open bracket: [

This is a closing bracket: ]

They are not frowny and smiley robot faces.

Braces are the curly and pointy things that you reach by using the Shift key with the bracket keys on American English qwerty keyboards. This is an open brace: {

This is a closing brace: }

I don’t even want to know what you emoticon worshippers think those might be.

In Perl (for example), braces are used to enclose blocks of code and define lexical scope as well as to identify hash elements, brackets are generally used to define array elements and regex character classes, and parentheses are mostly used for expression grouping and (when you feel like it) enclosing the arguments of functions and certain function-like operators. Try to avoid getting them mixed up. Doing so can ruin an otherwise perfectly good program — and every time you misidentify them in conversation with other programmers, you increase the likelihood that someone else will screw up a perfectly good program.

Think of the children.

(This is cross-posted to Geekend.)


  1. I don’t even want to know what you emoticon worshippers think those might be.


    : {

    Is a broken heart.

    : }

    Is an “aww, I don’t know what to say!”


    Comment by Mina — 30 December 2006 @ 10:09

  2. : { looks like a guy with a cleft palate and upper lip.

    Comment by apotheon — 30 December 2006 @ 11:10

  3. […] apotheon also clears up the distinction between round, square, and curly brackets — er, I mean parentheses, brackets, and braces. Another set of delimiters whose misnomer can piss me off are the so-called “angle brackets”. They’re “less than” and “greater than”, people! […]

    Pingback by Chipping the web - extraterrestrial inspiration -- Chip’s Quips — 30 December 2006 @ 04:47

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

All original content Copyright Chad Perrin: Distributed under the terms of the Open Works License