I am trying to verify that a variable is not equal to either 0 or 1. I tried using the following but neither work:

if x ~= (0 or 1) then
    print("x is not equal to 1 or 0")
end
if x ~= 0 or 1 then
    print("x is not equal to 1 or 0")
end

Conversely using == in this manner does not work either:

if x == (0 or 1) then
    print("x is equal to 1 or 0")
end
if x == 0 or 1 then
    print("x is equal to 1 or 0")
    return
end

Is there a way to do this?

Edit
Report