Re: Variable assignment in “if” condition in Dlang

Steven Schveighoffer schveiguy at gmail.com
Sun May 3 15:59:10 UTC 2020


On 5/3/20 11:27 AM, Adam D. Ruppe wrote:
> On Sunday, 3 May 2020 at 14:53:21 UTC, Baby Beaker wrote:
>> How can I assign a variable in “if” condition in Dlang?
> 
> depends on exactly what there's also
> 
> if ( (a = 10) )
> 
> with extra parens for special purposes

That doesn't work. You need to do a comparison or a cast.

-Steve


More information about the Digitalmars-d-learn mailing list