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.
Get Programming ColdFusion MX, 2nd Edition 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.