| Contents > Getting Started Building ColdFusion MX Applications > CFML Basics > Working with CFML expressions > Building expressions Specifying operators in expressions |
|
|
|
|
||
In ColdFusion, you use operators to test conditions; for example, you use the IS operator to test for equality. When using operators in expressions, you must only use supported logical operators that ColdFusion can interpret properly. For example, if you use the greater than operator (>)or the less than operator (<), ColdFusion interprets these operators as the start or end of a tag.
The following table lists the nonsupported logical operators and their equivalent ColdFusion operators:
Nonsupported logical operator |
Equivalent ColdFusion |
|
|---|---|---|
= |
IS, EQUAL, EQ |
Tests for equality. |
< |
LT, LESS THAN |
Tests for less than. |
<= |
LTE, LE, LESS THAN OR EQUAL TO |
Tests for less than or equal to. |
> |
GT GREATER THAN |
Tests for greater than. |
>= |
GTE, GREATER THAN OR EQUAL TO |
Tests for greater than or equal to |
< > |
IS NOT, NEQ, NOT EQUAL |
Tests for nonequality. |
|
CONTAINS |
Tests whether a value is contained within a second value. |
|
DOES NOT CONTAIN |
Tests whether a value is not contained within a second value. |
The following table lists the arithmetic operators that ColdFusion supports:
Operators |
Description |
|---|---|
+, -, *, / |
The basic arithmetic operators: addition, subtraction, multiplication, and division. In the case of division, the right operand cannot be zero. |
+, - |
Unary arithmetic operators for setting the sign of a number either positive or negative (+ or -). |
Mod |
Returns the remainder (modulus) after a number is divided by a divisor. The result has the same sign as the divisor. The right operand cannot be zero; for example: 11 MOD 4 is 3. |
\ |
Divides two integer values. Use the \ (trailing slash) to separate the integers. The right operand cannot be zero; for example: 9 \ 4 is 2. |
^ |
Returns the result of a number raised to a power (exponent). Use the ^ (caret) to separate the number from the power. The left operand cannot be zero; for example: 2 ^ 3 is 8. |
The following table describes the one ColdFusion string operator that is a concatenation operator:
Operator |
Description |
|---|---|
& |
Concatenates strings. |
|
|
||
| Contents > Getting Started Building ColdFusion MX Applications > CFML Basics > Working with CFML expressions > Building expressions Specifying operators in expressions |
|
|
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6.1
Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/cfml_b19.htm
Comments
pinkuroy said on Mar 23, 2005 at 2:37 AM :