question about conditional operator (?:)

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 26 06:18:32 PDT 2016


On Tuesday, 26 July 2016 at 13:17:27 UTC, Adam D. Ruppe wrote:
> (n%p==0) ? n/=p : p+=1 ;


And actually, using ?: with /= and += is kinda bizarre.

I think you are better off leaving this as if/else since the 
point of this is the assignment rather than the return value.


More information about the Digitalmars-d-learn mailing list