You can define a function in the following places:
Creating a function within one application page might be useful if you want the code to be organized and readable. It is accessible only from the page on which it is declared, and it must be declared before it is used. You can create many functions within one CFML page. Therefore, you can create a library of functions that can be used throughout an application or within a subset of application pages. It is useful to group commonly used functions into separate files to be included when needed. |