[thelist] CF: Tip - Usage of Boolean Values
Frank
lists at frankmarion.com
Tue Jul 15 14:13:37 CDT 2003
<tip type="Cold Fusion" author="Frank Marion">
A simple little trick: Cold Fusion usually processes a cfif tag like this
[1] <cfif variable.is_true>
more quickly than
[2] <cfif variable.is_true EQ "Yes">
Boolean values are either yes or no, 1 or 0, true or false. I've found that
when I set a boolean as such <cfset variable.is_true = 1> that one can take
advantage of form [1] of checking for one's own variables. I'm told that
it's quicker, and I believe that it makes code more readable.
(Guestimate: [1] may be quicker because it's a simple evaluation of a
single boolean value, whereas [2] requires the fetching of the operand,
then the comparison of the two before returning the boolean.]
</tip>
I welcome enlightenment if the above is incorrect.
--
Frank Marion lists at frankmarion.com Keep the signal high.
More information about the thelist
mailing list