[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why don't bools have (some) bitwise operators?
- From: Sean Conner <sean@...>
- Date: Tue, 23 Feb 2021 18:49:01 -0500
It was thus said that the Great Sudipto Mallick once stated:
> Look at the following:
>
> X 0 0 1 1
> Y 0 1 0 1
> X xor Y 0 1 1 0
> X ~= Y 0 1 1 0
>
> So in all cases, X xor Y is equivalent to X ~= Y given that X, Y are
> boolean. Hope that helps.
Also, "and" and "or" in Lua short-circut evaluation.
if foo() and bar() then ... end
if foo() returns false, bar() is not called (because the rest of the
expression can never be true)
if foo() or bar() then ... end
if foo() returns true, bar() is never called (because the expression as a
whole is true)
-spc