The <cfreturn> Tag

When a ColdFusion Component is used, the name of the function to be executed is specified. Any code in that function is processed, and a result is returned back to the calling code. To return data, a <cfreturn> tag is used. Listing 11.4 is a modified version of the previous listing, this time with <cfreturn> tags included in the body.

Listing 11.4. intro.cfc—Introduction CFC Step 3
<!--- This is the introductory CFC ---> <cfcomponent> <!--- Get today's date ---> <cffunction name="today" returntype="date"> <cfreturn Now()> </cffunction> <!--- Get tomorrow's date ---> <cffunction name="tomorrow" returntype="date"> <cfreturn DateAdd("d", 1, Now())> </cffunction> <!--- Get yesterday's date ---> <cffunction name="yesterday" returntype="date"> ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started 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.