One document about Go

Steven Schveighoffer schveiguy at yahoo.com
Tue Jun 1 12:53:30 PDT 2010


On Wed, 02 Jun 2010 15:39:16 -0400, Alex Makhotin <alex at bitprox.com> wrote:

> Walter Bright wrote:
>> You inevitably forget to go back and append the ; to the previous line.
>
> Current DMD compiler version outputs on attempt to make empty statement:
>
>> use '{ }' for an empty statement, not a ';'
>
> Is there a reason?

Yes, this:

if(x == 5 || x == 6);
    n = 4;

Typing a semi-colon is so automatic, that we will accidentally put one  
where we don't want to (I've done it many times).  This is one of those  
rare cases where people can easily type valid code that does not do what  
they want.

-Steve


More information about the Digitalmars-d mailing list