diff --git a/AST.cpp b/AST.cpp index 7ce3e5b..1f9fd4f 100644 --- a/AST.cpp +++ b/AST.cpp @@ -179,7 +179,7 @@ std::shared_ptr UnaryAST::eval(Context* parent) { auto valS = std::dynamic_pointer_cast(val); switch (this->op) { case NOT: - return std::make_shared(val->isArray() || (valS && !valS->isNil())); + return std::make_shared(!val->isArray() && valS && valS->isNil()); case MAKE_ARRAY: if (val->isArray() || (valS && !valS->isInt())) throw std::runtime_error("Array size must be an integer");