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

20. User-Defined Functions > 20.1. UDF Basics

UDF Basics

To create a tag-based UDF, you use the cffunction tag. Optionally, one or more cfargument tags can be used to define both required and optional arguments the function should expect as input. Data can be returned from the UDF using the cfreturn tag. Here’s some code that shows the basic syntax for a tag-based UDF:

<cffunction name="function_name" 
            output="Yes|No" 
            returntype="return_type"
            roles="authorized_roles">
  <cfargument name="arg1" type="arg_type" required="Yes|No" 
              default="default_val">
  <cfargument name="arg2" type="arg_type" required="Yes|No"
              default="default_val">
  ...
  additional CFML 
  <cfreturn expression>
</cffunction>

The


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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