> I understand that a CFC method with returntype="void" isnt going to
> send anything back, but what specifically does returntype="void"
> mean?
>
> For example, does it mean that even if the function tries to return a
> value it's not going to? or if it tries to return a value it'll throw
> an error? Why have this value at all? If there's no <cfreturn tag
> in the method, there will be no value returned, so what does this do?
It means that no value will be returned. So, if you have a function like
this:
<cffunction name="foo" returntype="void">
<cfreturn>
</cffunction>
you can't effectively do this:
<cfoutput>#foo()#</cfoutput>
or this:
<cfset myvar = foo()>
This allows the use of CFRETURN within the function without needing to
actually return anything, which can be useful since CFRETURN exits the
function:
<cffunction ...>
<cfif something is true>
[do something]
<cfreturn>
</cfif>
do something else
<cfreturn>
</cffunction>
In general, though, I usually don't do this within CF, since it differs from
how built-in CF functions work - they always return something, even if it's
just "Yes".
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210566
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54