Basic If Statements
ColdFusion if statements are created using the <cfif> tag. <cfif> takes no attributes; instead, it takes a condition. For example, the following <cfif> statement checks to see whether a variable named FirstName contains the value Ben:
<cfif FirstName IS "Ben">
The keyword IS is an operator used to test for equality. Other operators are supported, too, as listed in Table 9.1.
Operator | Shortcut | Description |
---|---|---|
EQUAL | IS, EQ | Tests for equality |
NOT EQUAL | IS NOT, NEQ | Tests for nonequality |
GREATER THAN | GT | Tests for greater than |
GREATER THAN OR EQUAL TO | GTE | Tests for greater than or equal to |
LESS THAN | LT | Tests for less than |
LESS THAN OR EQUAL TO | LTE | Tests for less than or equal to |
CONTAINS | Tests whether a value is contained ... |
Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started 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.