Home arrow ColdFusion arrow Page 3 - What You Must Know About Operators in ColdFusion!

What You Must Know About Operators in ColdFusion!

The fabric of a program consists of expressions, large and small, stitched together with operators and interspersed with functions. The larger expressions as well as the functions themselves may be the result of development from a number of smaller expressions. An understanding of the operators and their correct usage is therefore very essential. This tutorial describes the various operators by presenting comprehensive examples of their usage tested on the MX 6.1 server. <CFScript> will be used in all the examples.

Author Info:
By: Jayaram Krishnaswamy
Rating: 4 stars4 stars4 stars4 stars4 stars / 21
August 22, 2005
  1. · What You Must Know About Operators in ColdFusion!
  2. · Conditional Operators
  3. · Logical Operators
  4. · String Operator

print this article

What You Must Know About Operators in ColdFusion! - Logical Operators
(Page 3 of 4 )

Operator Truth Table/Description
NOT Negates the argument.
If argument is 'true', it produces 'false',
and vice versa
XOR (Exclusive or)
EQV (Equivalence)
IMP (Implication))
Code example

An example with all the operators is shown in the code below, followed by the result of browsing the file. Since the logical operators operate on Boolean operands, it can be seen that the Boolean results obtained by using the conditional operators can be combined using the Boolean operators to evaluate complex conditions (for example, to flag a person based on sex, salary level, and marital status to pick up a certain tax rate range).

WriteOutput("<br><h4>Test Boolean evaluations</h4>");
WriteOutput("[TRUE] <b>OR</b> [FALSE] is :  " & Evaluate(True OR False));
WriteOutput("[TRUE] <b>AND</b> [FALSE] is :  " & Evaluate(True AND False));
WriteOutput("[TRUE] <b>XOR</b> [FALSE] is :  " & Evaluate(True XOR False));
WriteOutput("[TRUE] <b>EQV</b> [FALSE] is :  " & Evaluate(True EQV False));
WriteOutput("[TRUE] <b>IMP</b> [FALSE] is :  " & Evaluate(True IMP False));

Result of evaluation:

blog comments powered by Disqus

- Adobe ColdFusion Just Got More RAD
- How to Access a SQL Anywhere Database with C...
- CFXML: Probing XMLDOM in ColdFusion
- Creating a Web Service with ColdFusion: the ...
- CFAjax: What it is and How to Use it
- Querying SQL 2000 Server from ColdFusion
- Introduction to ColdFusion Markup Language, ...
- Introduction to ColdFusion Markup Language
- Databases and Dreamweaver MX 2004, concluded
- Databases and Dreamweaver MX 2004
- Welcome to Coldfusion MX 6.1, concluded
- Welcome to Coldfusion MX 6.1
- What You Must Know About ColdFusion Flow-Con...
- What You Must Know About Operators in ColdFu...
- Everything You Must Know About ColdFusion Va...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials