nil 作比较时应该加上双引号 "

> type(X)
nil
> type(X)==nil
false
> type(X)=="nil"
true
> 
原文地址:https://www.cnblogs.com/sea-stream/p/9978145.html