is there a reason declarative style if are allowed, but not while ?

deadalnix deadalnix at gmail.com
Fri Feb 26 20:32:18 UTC 2021


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()) { ... }




More information about the Digitalmars-d mailing list