Used with cfelse and cfelseif, cfif lets you create simple and compound conditional statements in CFML. The value in the cfif tag can be any expression.

This tag cannot have a body.

This tag is also supported within <cfscript>

This tag does not use any attributes.



Simple Example with tag format

lucee+trycf <cfif isArray(SERVER)> <cfset result="It is in Array format" > <cfelse> <cfset result="It is not in Array format" > </cfif> <cfdump var="#result#" />

Simple example with script format

luceescript+trycf //script format numb=1 if(numb gt 1){ writeOutput("It is greater than 1 "); }else{ writeOutput("It is not greater than 1 "); }

See also