On Saturday, 27 July 2013 at 12:39:24 UTC, monarch_dodra wrote:
On Friday, 26 July 2013 at 00:38:46 UTC, John Colvin wrote:
After a few weeks of not getting around to it, here's my second post:


I tried to post a comment on your blog, but I failed. Anyways, I wanted to post:

And here is the second comment I wanted to put:

When parsing the options, you use an if-else. I don't know if its just me, but I find that using a switch is clearer (it's what you do in your second example). It also introduces string cases (illegal in C++), and labeled control statements.

The code becomes:

import std.stdio : writef, writeln;
void main(string[] args)
    args = args[1 .. $];
    bool writeNewline = true;

    size_t i = 0;
    myForeach: foreach(arg; args)
            case "-n":
                writeNewline = false;

                break myForeach;
    args = args[i .. $];

    writef("%-(%s %)", args);

PS: If I figure out how to comment on your blog, I'll paste the comments there :)

Reply via email to