Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: &&||



On 20/02/18 09:07 AM, Peter Stephenson wrote:
You've now extended your demand so that it works with an else clause as

Not 'extended' that is the entire point of my question. I'm expecting the '||' to be identical to a logical 'else', there is no other issue.

Demand? I seek clarification, mind, if it were agreed that my sense of the logic were correct I'd be happy to see it change, but issues of logic and code flow are rigorous and not subject to opinion.
You could do this, I suppose.

first-statement && {
     any-old-stuff
     true				<< right, I see how that protects.
} || {something-else-entirely}

Ok, I'm at least on guard for that sort of thing from now on.  I've more and more been using &&|| constructions in place of if/else simply because the former is more compact, but I'll be more vigilant from now on.  Braces are ignored as far as truth tests on the left of any && or ||.  I can't say I like it tho, not that that matters, a thing like this is entirely at your discretion.




Messages sorted by: Reverse Date, Date, Thread, Author