Reputation: 129
Simple piece of code, supposed to print works
is not doing so. I really can't understand this.
This is code:
local var = 1
if not var == nil then
print("works")
end
Upvotes: 2
Views: 77
Reputation: 72402
Operator precedence fooled you:
if not asd == nil then
is equivalent to
if (not asd) == nil then
Try
if not (asd == nil) then
Upvotes: 3
Reputation: 129
Sorry, answer was doing
local asd = 1
if asd ~= nil then
print("works")
end
I didn't even knew that ~= is a thing wow
Upvotes: 1