O'Reilly logo

Programming ColdFusion MX, 2nd Edition by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 19. Scripting

When ColdFusion 4.0 was released, it introduced a new server-side scripting language called CFScript. CFScript is similar in appearance to JavaScript and allows you to write sections of code in your templates using a more concise format than tag-based CFML. CFScript isn’t meant to replace the CFML language; it just provides you with a choice of styles for coding your pages. ColdFusion 5.0 introduced developers to user-defined function. Now, in ColdFusion MX, CFScript adds the ability to trap and handle errors with try/catch constructs. Those used to programming in JavaScript will find the CFScript constructs quite familiar. This chapter covers everything you need to know about the CFScript language, along with examples.

CFScript-based user defined functions (UDFs) were added to the ColdFusion language in Version 5. This functionality allows you to use CFScript to write custom functions that can be used just like any of ColdFusion’s built-in functions. To facilitate this, three additional CFScript statements, function, var, and return, were added to the language. These statements are covered in detail in Chapter 20. For now, all you need to know is that they are considered reserved words in CFScript.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required