• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. CFScript

Chapter 13. CFScript

Because ColdFusion is a tag-based markup language, most web developers should find it relatively easy to pick up. However, developers accustomed to procedural and scripting languages often find ColdFusion’s syntax ambiguous, overly simplified, or insufficient when it comes to complex or lengthy logical statements. The creators of ColdFusion realized this and tried to surmount it with the introduction of CFScript in ColdFusion 4.1. CFScript provides a method for developers who are more comfortable using scripting-based languages, such as JavaScript, to exploit their knowledge and skill. CFScript, until recently, was also the only way to create user-defined functions (UDFs). In fact, many of the examples in this chapter will be in either standard ColdFusion Markup Language (CFML) or CFScript, so the following section provides a short primer of sorts to familiarize the reader with CFScript.

CFScript can be used to set variables, loop through collections, and work with the many ColdFusion functions and expressions. One will often find that CFScript enables the author to write much clearer logic, as well as more succinct code in specific instances. Although we cannot show every instance in which CFScript should be used instead of CFML, we will provide some rules of thumb. The most important rule of thumb is to use the syntax with which you are most productive. All other considerations come after that!


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint