Basic coding style

Max Samukha spambox at d-coding.com
Tue Nov 23 04:12:34 PST 2010


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; }}}

Nowadays most programmers have 16:9 displays, so the good coding style 
is to write as much as possible in one line. And the more misaligned the 
curies are, the better.



More information about the Digitalmars-d mailing list