is there a reason declarative style if are allowed, but not while ?
Timon Gehr
timon.gehr at gmx.ch
Sun Feb 28 14:32:32 UTC 2021
On 26.02.21 21:32, deadalnix wrote:
> D allows for this type of constructs:
>
> if (auto foo = bar()) { ... }
>
> I was trying to do something similar with a while loop, but DMD seems
> very upset about it. Is there a reason to disallow the following?
>
> while (auto foo = bar()) { ... }
>
>
I don't think there's any good reason.
Related: https://issues.dlang.org/show_bug.cgi?id=16140
FWIW, note that this works in C++.
More information about the Digitalmars-d
mailing list