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

deadalnix deadalnix at
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 

while (auto foo = bar()) { ... }

More information about the Digitalmars-d mailing list