single loop copy in D

Andrea Fontana nospam at example.com
Fri Mar 2 10:01:04 UTC 2018


On Friday, 2 March 2018 at 09:44:20 UTC, psychoticRabbit wrote:
> trying to do this C code, in D, but getting error:
> "Error: assignment cannot be used as a condition, perhaps `==` 
> was meant?"
>
> any help much appreciated:
>
> ------
> while ((*dst++ = *src++)) {}
> ------

You can't use this syntax inside a while/if/... to prevent 
mistakes due to similarity between assignment syntax (=) and 
comparison syntax (==)

Andrea



More information about the Digitalmars-d-learn mailing list