我希望编制一份 ColdFusion 认为虚假和真实的值的完整列表。我所知道的有:
//falsy values
false
"false"
0
"no"
//truthy values
true
"true"
!= 0
"yes"
我这里有什么遗漏的吗?
最佳答案
这里有一篇关于此的简洁的小文章 http://www.coldfusionmuse.com/index.cfm/2010/2/5/Booleans.and.Coldfusion
但当然官方是 http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec09af4-7fd0.html
In Boolean expressions, True, nonzero numbers, and the strings “Yes”, “1”, “True” are equivalent; and False, 0, and the strings “No”, “0”, and “False” are equivalent.
Boolean evaluation is not case sensitive. For example, True, TRUE, and true are equivalent.
所以,使用你的术语:
//falsy values
False
"False"
0
"No"
//truthy values
True
"true"
!= 0
"Yes"
"1"
关于coldfusion - ColdFusion 认为 "falsy"和 "truthy"的所有值是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7278528/