首页 > 代码库 > 为何lua python 下运行结果类型不统一

为何lua python 下运行结果类型不统一

print(true or 1)     ------------------- true
print(true or 0)  ------------------- true
print(false or 1) ------------------- 1
print(false or 0) ------------------- 0


print(0 or true) ------------------- 0
print(1 or true) ------------------- 1
print(0 or false) ------------------- 0
print(1 or false) ------------------- 1




print(true and 1) ------------------- 1
print(true and 0) ------------------- 0
print(false and 1) ------------------- false
print(false and 0) ------------------- false


print(4 and true) ------------------- true
print(1 and true) ------------------- true
print(0 and false) ------------------- false
print(1 and false) ------------------- false