Re: Replacing the "if" statement with an "if" expression which supersedes it

Andrey Dobrovolsky <[email protected]> Fri, 26 Jun 2026 19:59:00 +0300
Newsgroups gmane.comp.lang.lua.general
Message-ID <CAN5FJ7ekY1hA9=UbUzTuKOOqTFXsRtmRjsq_tKc8wshNpZFzZg@mail.gmail.com>
Hi Paul,

> I usually just negate the condition when I run into this situation:
>
> > not(10 < 11) and (0) or (false)
> false
>
> Paul.

I think the problem appears when You process variables and any of them
may be not-true. The fault mentioned by Calimero is caused by the
and-ed one.

-- Andrew

пт, 26 черв. 2026 р. о 19:50 Paul K <[email protected]> пише:
>
> Hi Calimero,
>
> On Fri, Jun 26, 2026 at 8:44 AM 'Calimero' via lua-l
> <[email protected]> wrote:
> > Le 26/06/2026 à 17:32, Andrey Dobrovolsky a écrit :
> > > (10 < 11) and ("yes") or ("no")
> > yes
> > > (10 < 11) and (false) or (0)
> > 0
> >
> > Can you fix the second example to return `false` as it should, by adding some parentheses? I experimented but failed.
>
> I usually just negate the condition when I run into this situation:
>
> > not(10 < 11) and (0) or (false)
> false
>
> Paul.
>
> --
> You received this message because you are subscribed to the Google Groups "lua-l" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To view this discussion visit https://groups.google.com/d/msgid/lua-l/CADUw5q0pqcECiUD2Y8m%2B4BV1pyrsJHZ364jzksKx-jecTU5C3Q%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/CAN5FJ7ekY1hA9%3DUbUzTuKOOqTFXsRtmRjsq_tKc8wshNpZFzZg%40mail.gmail.com.