Variable Naming

This would be a good place to discuss variable naming. When you create a variable you get to name it, and the choice of names is up to you. However, you need to know a few rules about variable naming:

  • Variable names can contain alphanumeric characters but can’t begin with a number (so result12 is okay, but 4thresult is not).

  • Variable names can’t contain spaces. If you need to separate words, use underscores (for example, monthly_sales_figures instead of monthly sales figures).

  • Aside from the underscore, non-alphanumeric characters can’t be used in variable names (so Sales!, SSN#, and first-name are all invalid).

  • Variable names are case insensitive (FirstName is the same as FIRSTNAME, which is the same as firstname, which is the ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.