Name

CFIF

Synopsis

<CFIF expression>
   HTML and CFML
<CFELSEIF expression>
   HTML and CFML
<CFELSE>
   HTML and CFML
</CFIF>

Performs if-then-else processing of expressions. CFIF/CFELSEIF/CFELSE statements can be nested, and multiple CFELSEIF statements may be used within a single CFIF block. CFIF statements can contain more than one expression to evaluate, as in:

<CFIF IsDefined('MyVar') AND MyVar IS "a">

Compound CFIF statements that contain multiple expressions separated by operators, such as AND and OR, are processed using short-circuit Boolean evaluation. This means that ColdFusion stops processing the CFIF statement once an expression evaluates to TRUE. Consider using CFSWITCH when you have many cases, as it is generally faster than CFIF.

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.