Home arrow ColdFusion arrow Page 7 - Everything You Must Know About ColdFusion Variables
COLDFUSION

Everything You Must Know About ColdFusion Variables


Understanding ColdFusion variables and logic is vital to being able to program in the language. In this tutorial, Jay's second covering ColdFusion, you will learn about the types of ColdFusion variables and how to use them.

Author Info:
By: Jayaram Krishnaswamy
Rating: 4 stars4 stars4 stars4 stars4 stars / 25
August 15, 2005
TABLE OF CONTENTS:
  1. · Everything You Must Know About ColdFusion Variables
  2. · Developing ColdFusion Content
  3. · Variable definition with CFSET tag
  4. · Variable by assigning statements in CFSCRIPT
  5. · Scope of a variable
  6. · Data Type Category of Variables
  7. · How do we name a variable?

print this article
SEARCH DEVARTICLES

Everything You Must Know About ColdFusion Variables - How do we name a variable?
(Page 7 of 7 )

  • The first character of a variable name must be one of: a letter, an underscore character, or a Unicode currency symbol. Subsequent characters can be any number of characters, numbers, underscores, and Unicode currency symbols and their combinations.

  • Variables should be an unbroken string, no white spaces. In other words, firstName is OK, first Name is not good.

  • No dot (or period[.]) is allowed in the variable name, as it may be taken for a structure access, or scope access.

  • Use a standard naming convention: FIRSTNAME can be written as firstName, FirstName, First_Name. In this tutorial we will be use the 'firstName' type most often.

  • While using forms, databases, and so on, make sure that the names used for the field do not conflict with other variables, since they are also considered as variables.

  • Stick to a meaningful variable name, like firstName, instead of fn. Brevity may be the soul of wit, but not in programming.

Programmers in Visual Basic are used to attaching a three letter prefix to the variable name to indicate the data type of a variable. This makes reading of the code easy and rapid. A similar, but consistent scheme may be used.

Summary

In this tutorial the nature of variables in ColdFusion has been described. Several examples have been presented. Usage examples given can be pasted into a text editor and saved with the ColdFusion file extension. Server side extension using CFSCRIPT has been explained. With a properly configured web server these files can be processed. A proper naming convention will go a long way towards ease of reading, and troubleshooting.


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
COLDFUSION ARTICLES

- 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 
Support 

Developer Shed Affiliates

 




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