Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>"yes/no"</code> is a few characters less to type.</p> <p><code>"true/false"</code> (and true/false) is more in line with other programming languages.</p> <p>In terms of performance, they are all strings as far as CF is concerned. It is not until you try to use them in conditional logic that they magically change into other data types, like java.lang.Boolean. The conversion between strings and Booleans and back again is very fast. It's what CF does most of the time. You'd be hard pressed finding any reliable tests proving one faster than the other.</p> <p>For code maintainability/readability it's best to stick with one or the other.</p> <p>Some legacy CF tag functions specifically require "yes/no". They simply will not work with "true/false". I believe this is no longer the case in CF9+.</p> <p>Don't rely on the ColdFusion documentation being accurate or up to date. Almost all of the methods that list "yes/no" as the default/allowed values actually support any kind of boolean value. "yes/no", "true/false", true/false, 1/0, etc.</p> <p>IMHO using "yes/no" for booleans is crazy. Backwards compatibility from the old CF5 era. Sucks that Adobe are still using it to output java Booleans.</p> <p>eg. <code>writeDump( var: (not true) );</code> gives you "NO". But, I wanted <code>false</code>?! Grrr.</p> <p>You can tell what java class your variable is currently by calling <code>myVar.getClass().getName()</code>. You can use it to watch CF casting your data from Boolean to String and back to Boolean again, like magic.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload