什么是ColdFusion认为的“假的”的所有值和“真实”。 [英] What are all the values that ColdFusion considers "falsy" and "truthy"?
问题描述
我想编译一个完整的ColdFusion认为虚假和真实的值的列表。我知道的是:
I'm looking to compile a complete list of values that ColdFusion considers falsy and truthy. The ones I know of are:
//falsy values
false
"false"
0
"no"
//truthy values
true
"true"
!= 0
"yes"
我在这里缺少什么吗?
Is there anything that I'm missing here?
推荐答案
这里有一个整洁的小文章 http://www.coldfusionmuse.com/index.cfm/2010/2/5/Booleans.and.Coldfusion
There's a neat little article on that here 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
在布尔表达式中,True,非零数字和字符串Yes,1,True是等效的;和False,0,字符串No,0和False是等价的。
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.
布尔值不区分大小写。例如,True,TRUE和true是等价的。
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认为的“假的”的所有值和“真实”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!