Re: Replacing the "if" statement with an "if" expression which supersedes it
"'Calimero' via lua-l" <[email protected]> Fri, 26 Jun 2026 19:16:41 +0200
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
Le 26/06/2026 à 18:50, Paul K a écrit : > 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. My brain hurts seeing this! I would be fine if it were hurting because I made it work hard to produce code that is easily understandable, but this is not it. These contorsions in fact illustrate very well why I want to keep the existing conditional syntax (except now it has a value): `if 10 < 11 then false else 0 end` is so much clearer. I need my attention on the programming, not on the coding, and I think so do many of us! -- 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/0971056a-9c95-5266-dbde-3ace8b1dab86%40free.fr.