O'Reilly logo

Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started by Charlie Arehart, Raymond Camden, Ben Forta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Table 9.1. CFML Evaluation Operators
OperatorShortcutDescription
EQUALIS, EQTests for equality
NOT EQUALIS NOT, NEQTests for nonequality
GREATER THANGTTests for greater than
GREATER THAN OR EQUAL TOGTETests for greater than or equal to
LESS THANLTTests for less than
LESS THAN OR EQUAL TOLTETests for less than or equal to
CONTAINS Tests whether a value is contained ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required