Optional braces

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Aug 26 09:30:03 PDT 2011


I've used this a few times:

foreach (dir; dirs)
foreach (string file; dirEntries(dir, SpanMode.shallow))
{
    if (file.isFile)
        // do something..
}

And I only use this in short loops like this. It's more compact, I
dislike having to create too much indentation.

I don't see what banning this buys us. If we're going to force some
kind of predefined coding style on everyone then we might as well get
rid of the semicolon as well.


More information about the Digitalmars-d mailing list