What are all the values that ColdFusion considers "falsy" and "truthy"?
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
tr开发者_StackOverflow社区ue
"true"
!= 0
"yes"
Is there anything that I'm missing here?
There's a neat little article on that here http://www.coldfusionmuse.com/index.cfm/2010/2/5/Booleans.and.Coldfusion
but of course officially it's 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.
So, using your terminology:
//falsy values
False
"False"
0
"No"
//truthy values
True
"true"
!= 0
"Yes"
"1"
精彩评论