The following rules apply to functions that you define using CFScript or the cffunction tag:
- The function name must be unique. It must be different from any existing variable, UDF, or built-in function name, except you can use the ColdFusion advanced security function names.
- The function name must not start with the letters cf in any form. (For example, CF_MyFunction, cfmyFunction, and cfxMyFunction are not valid UDF names.)
- You cannot redefine or overload a function. If a function definition is active, ColdFusion generates an error if you define a second function with the same name.
- You cannot nest function definitions; that is, you cannot define one function inside another function definition.
- The function can be recursive, that is, the function definition body can call the function.
- The function does not have to return a value.
You can use tags or CFScript to create a UDF. Each technique has advantages and disadvantages.