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

Chapter 18. Scripting > User-Defined Functions

18.4. User-Defined Functions

In ColdFusion 5.0, you now have the ability to create user-defined functions (UDFs) that can be called inline, just like other ColdFusion functions. The premise behind UDFs is to allow you to extend ColdFusion's core set of functions with custom ones that encapsulate programming tasks not currently addressed by the language. For example, there is no CFML function for calculating the mean (average value) of a delimited list of numeric values. Rather than writing code that uses multiple functions each time you want to calculate the mean for a given list of numbers, you can create a UDF that can be called inline as often as you want in your template.

Before we get into the specifics of defining and calling UDFs, you should be aware of a few rules related to their use:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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