150
cfif/cfelseif/cfelse
Description
Used with
conditional statements in CFML. The value in the
Category
Flow-control tags
Syntax
<cfif expression>
<cfelseif>
<cfelse expression>
</cfif>
See also
cfabort, cfbreak, cfexecute, cfexit, cflocation, cfloop,
cfcase/cfdefaultcase, cfthrow,
Usage
When testing the return value of a function that returns a Boolean, you do not have
to explicitly define the TRUE condition. The following code uses
example:
<cfif IsArray(myarray)>
When successful,
TRUE. This method is preferred over explicitly defining the TRUE condition:
<cfif IsArray(myarray) IS TRUE>
For example:
<cfif "11/23/1998 " GT "11/15/1998 ">
This switch is set on the ColdFusion Administrator Server Settings page. For more
information, see Advanced ColdFusion Administration.
Example
<!--- This example shows the interaction of cfif, cfelse,
...
<H3>cfif Example</H3>
<P>cfif lets you perform conditional logic
based on a condition or set of conditions.
<P>For example, you can output the list of Centers from the
snippets datasource by group and only display <B>IF</B>
the city = San Diego.
<hr>
<!--- use cfif to test a condition when outputting a query --->
<P>The following are centers in San Diego:
<cfoutput query = "getCenters" >
<cfif city is "San Diego">
</cfif>
</cfoutput>
and
cfelse
cfelseif
HTML and CFML tags
HTML and CFML tags
HTML and CFML tags
IsArray
and cfelseif --->
<BR><B>Name/Address:</B>#Name#, #Address1#, #City#, #State#
<BR><B>Contact:</B> #Contact#<BR>
,
lets you create simple and compound
cfif
cftry
cfcatch
evaluates to YES, the string equivalent of the Boolean
Chapter 2 ColdFusion Tags
tag can be any expression.
cfif
cfswitch/
IsArray
as an
Need help?
Do you have a question about the COLDFUSION 5 - CFML and is the answer not in the manual?