On 07/15/2014 11:08 AM, Martin Krejcirik wrote:

Example?


For loop with multiple variables and various one liners of questionable
utility aside:

import std.stdio;

bool funk()
{
     static int count;
     return ++count > 1 ? true : false;
}

void main()
{
     bool flag = false;
     if (flag && funk)
         writeln("a");
     else if (flag=true, flag && funk)
         writeln("b");
     else if (flag && funk)
         writeln("c");
}


Is the following the intended equivalent?

    if (flag && funk)
        writeln("a");
    else {
        flag=true;

        if (flag && funk)
            writeln("b");
        else if (flag && funk)
            writeln("c");
    }

If I had to ask nobody should use the version you wrote! ;)

Ali

Reply via email to