The Comma Operator's Deprecation Can't Come Soon Enough
Ali Çehreli via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 15 11:24:52 PDT 2014
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
More information about the Digitalmars-d
mailing list