Possible Duplicate:
Why are statements in many programming languages terminated by semicolons?

I just found out that R Programming Language, which is somewhat belong to the C family (I'm not sure about this but it uses {} instead of begin end), uses a new line as a delimiter for a new line of code instead of the semi-colon ;.

Why is some programming language designed to use a new line instead of a symbol like semi-colon which I think will make the code more readable?


total = item_one + \
        item_two + \


total = item_one +
        item_two +
  • This isn't a duplicate at all.The other question is about symbology in languages that use a line ending delimiter. This one is about why you would delimit line-endings at all. I was going to ask a question along the lines of "What is the benefit of NOT having a line-ending delimiter in a language," but this question pretty much covers that. The other one doesn't.
    – naught101
    Jul 31, 2012 at 4:57
  • 1
    @naught101 This really isn't what is being asked here, but I actually like the question you proposed. Perhaps you should post your own question about this?
    – maple_shaft
    Jul 31, 2012 at 11:33
  • @maple_shaft: it may not be being asked here directly, but it is kind of implied, and the answers pretty much cover it...
    – naught101
    Jul 31, 2012 at 11:52

3 Answers 3


The idea behind semantic whitespace in Python is that the program structure as seen by the interpreter should match the structure as seen by humans as closely as possible. Consider the following C program:

if ( foo )

At first glance, you'll assume that bar and baz are both conditional; they aren't, however, due to misleading indentation. The C way of thinking is "make your whitespace match semantics". The Python way is more along the lines of thinking DRY: "whitespace already expresses program structure, just parse it".

  • Good answer, hadn't thought of it that way before. I guess the requirement of a \ for line continuation as opposed to a ; for line termination is also a lot less typing, in the long run. It must be a PHP-related hang-up of mine that line continuation just looks damn ugly :)
    – naught101
    Jul 31, 2012 at 5:02

Any answer to this is going to be subjective. There was a big discussion about why the semicolon was used to terminate statements in this question. The bottom line is that any scheme can be made parseable and it is up to the language designer to choose their own statement termination scheme. This choice will be influenced by the emotional baggage that they attach to each scheme. Some people have a pathological loathing for semicolons or other explicit statement termination characters, while others see utility in having an explicit, visible termination character.


The semicolon in C and languages that adopt its syntax is used to terminate statements. Put simply it's the symbol the compiler looks for to know where a statement ends, and by association where the next one begins.

It's mostly a quirk of the language, a convention. Whether it makes code more readable or not depends a lot on your personal preferences, I don't think there is a valid metric that can be applied objectively. Wikipedia has an extensive list of languages organized per their statement terminator, and some of the popular newline terminated / separated languages are:

  • Haskell,
  • BASIC,
  • Eiffel,
  • Fortran,
  • Visual Basic

and others.

You can find a very interesting discussion on whether semicolons or newlines should be used as statement separator/terminator here: http://www.cs.nmsu.edu/~jeffery/godiva/semi.html. Sum of the discussion is that Larry Wall really likes his semicolons ;)

  • Heh. "Forgetting a trailing semicolon is a common goof in a variety of languages..." That's probably the best argument against termination characters. Having optional semi-colons based on preceeding syntax seems like a stupid idea - there's plenty of cases where it's not clear at first glance what's an expression and what's not..
    – naught101
    Jul 31, 2012 at 5:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.