[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Behavior of logical operators
- From: "Andre Naef" <andre@...>
- Date: Sun, 13 Mar 2011 12:44:22 +0100
I am somewhat at a loss understanding the following behavior of the shortcut
evaluation of the logical operators "and" and "or" in Lua 5.1.4.
The following works as expected:
> return 1 or 2
1
> return (1 or 2) and true
true
However, the following expression returns a result I do not expect:
> return (1 or 2) and true or false
1
I would expect this expression to return "true". What am I missing?