Instead of declaring each variable in a CFFUNCTION block individually,
I find it much easier to create a single structure that's function
local and then add members to it as needed:

<cfset var local = structNew() />
<cfset local.firstName = "John" />
<cfset local.lastName = "Smith" />

Since all function local variables need to be declared at the top of
CFFUNCTION block (just below any CFARGUMENT tags) your code gets
littered with a lot of messy initializations if you use the "declare
each variable as 'var' individually" approach.  Using the "local
scope" allows you to create variables as you need them which I find
pretty convenient.  Also don't forget to use "local." in the name
attribute of a CFQUERY tag that returns a result set, i.e.

<cfquery name="local.getUsers" datasource="dsn">
SELECT ...
</cfquery>


HTH,

Cliff


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to