lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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