Basic coding style

Kagamin spam at here.lot
Tue Nov 23 07:00:07 PST 2010


Max Samukha Wrote:

> On 11/23/2010 01:17 PM, Kagamin wrote:
> > void func(string[] strings) {
> >>       string[] result;
> >>       foreach (auto s ; strings) {
> >>           if (s != "") {
> >>               writefln("found: %s", s);
> >>               result ~= s; }}}
> 
> This takes too much vertical space and should be rewritten to:
> 
> void func(string[] strings) {string[] result; foreach(auto s; strings){ 
> if (s != "") { writefln("found: %s", s); result ~= s; }}}

I wanted to say D allows even python-style formatting. Brace matching editor will help in syntactical differences.


More information about the Digitalmars-d mailing list