lua-users home
lua-l archive

Unexpected behavior with "not not"

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


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

AltStyle によって変換されたページ (->オリジナル) /