if-expressions

Cauterite via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 30 07:37:29 PDT 2016


On Tuesday, 30 August 2016 at 07:41:35 UTC, w0rp wrote:
> I don't think this particular syntax is desirable. We already 
> have ternary expressions, and anything more complicated than a 
> regular ternary should probably be written with a regular 
> series of if statements.

The problem is when you're in the middle of a large expression 
which you don't want to break apart into statements (it might be 
the body of a '=>' lambda), your options are ternary conditionals 
(horrid syntax), or something like `{if (x) {return y;} else 
{return z;};}()` which is just as bad.


More information about the Digitalmars-d mailing list