On Sunday, 28 August 2016 at 13:48:43 UTC, Tomer Filiba wrote:
Python uses `x = 5 if cond else 6`, which is by far more readable

-tomer

conseq1 if cond1 else conseq2 if cond2 else conseq3 if cond3 else conseq4

I dunno man, it seems all backwards to me. If you're gonna do it this way, then you'd also want your if-statements like this:

{
    foo();
    bar();
} if (cond);

Could you imagine trying to read a function you didn't write yourself if branches were written like that?

But more importantly IMO the order of execution should be reflected in the syntax. Even if you put the condition in the middle, it still gets executed first.

Reply via email to