Home arrow ColdFusion arrow Page 4 - 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! - String Operator
(Page 4 of 4 )

ColdFusion has only one string (&) operator to contend with, unlike JavaScript which uses both & and + for string concatenation.

Operator Description Examples
& joins two pieces of text #x# & #y#
Example of usage
WriteOutput("The first name is: " & #firstName#);
WriteOutput("The last name is: " & #lastName#);
writeOutput("The full name is: " & #firstName# & " " & #lastName#);

Concatenated String:


A thorough understanding of the operators is essential for correctly combining smaller expressions to produce larger ones. While evaluating logical values, the outcome may come out as YES or NO, but the interpreter may not recognize it, resulting in a runtime error with a message saying variable 'YES' or 'NO' not found. You will be required to define 'YES' and 'NO' to be associated with 'TRUE' and 'FALSE'. This can be easily verified by commenting out the definitions of 'YES' and 'NO' in logical2.cfm. Also, care should be taken to pay attention to the precedence of operators for correct interpretation. The function evaluate(), introduced without much of an explanation, is a very useful function. It parses and evaluates the expression supplied as an argument, at run time.

DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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