Unexpected behavior with "not not"
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Unexpected behavior with "not not"
- From: "Aaron Brown" <aaron-lua@...>
- Date: 2005年6月30日 13:08:04 -0400
Hey everybody,
The third and fourth of the following lines don't seem right
to me. Do I have a faulty concept in my head?
print(not not nil) --> false
print(not not nil and true) --> false
print(not not (nil and true)) --> nil (!)
print(not (not (nil and true))) --> nil (!)
To take the fourth line as an example, I expect it to
evaluate like this:
* not (not (nil and true))
* not (not nil) -- innermost first
* not true
* false
(I get the same results on several versions of Lua.)
--
Aaron