<cfif>
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 must have a body.
This tag is also supported within <cfscript>
<cfif #boolean condition#><!--- body ---></cfif>
| Attribute | Description |
|---|---|
condition
boolean, optional
|
edit
condition o the expression |
Examples
editSimple example
Tag example
<cfset numb=12>
<cfif numb gt 1>
<cfoutput>It is greater than 1</cfoutput>
</cfif>
Script example
//script format
numb=12
if(numb gt 1){
writeOutput("It is greater than 1");
}
See also
- Core CFML Language
- <cfelse>
- <cfelseif>
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)