ColdFusion components allow you to return the values of all allowed data types. The cfreturn
tag, as we have seen in Chapter 1, and in the getCurrentDate()
method in the projects.cfc
code, returns a single variable. The return statement in CFScript also returns only one result at a time. If a requirement for the code was to send back more than one variable from the method, a structure or array could be returned containing all required variables and values.
When returning data from a method, you have the ability to explicitly specify what type of value is expected to be returned by using the returnType
attribute.
The returnType
attribute is a required attribute when developing ColdFusion components to be used as web services, but is an optional attribute for all other CFC functions.
This attribute allows you to specify what type of data the value is returning from a method. As it is not a required attribute, if nothing was defined, the default returnType...