Cheers all :-)

-----Original Message-----
From: Sean A Corfield [mailto:[EMAIL PROTECTED] 
Sent: 05 September 2003 17:00
To: CF-Talk
Subject: Re: Friday question.... any difference?


Block 2 works better if you are also declaring theName as a local 
variable in a cffunction:

        <cfset var theName = "Undefined" />
        <cfif myQuery.RecordCount>
                <cfset theName = myQuery.FIRST_NAME & " " &
myQuery.LAST_NAME>
        </cfif>

Otherwise I'd probably use block 1.

On Friday, Sep 5, 2003, at 03:39 US/Pacific, <[EMAIL PROTECTED]> 
wrote:

> I was mulling this over last night....
>
> Should there be any preference between the following two examples of 
> code?
>
>
> <!---  Code Block 1 --->
> <cfif myQuery.RecordCount>
>       <cfset theName = myQuery.FIRST_NAME & " " & myQuery.LAST_NAME> 
> <cfelse>
>       <cfset theName = "Undefined">
> </cfif>
>
>
> <!--- Code Block 2 --->
> <cfset theName = "Undefined">
> <cfif myQuery.RecordCount>
>       <cfset theName = myQuery.FIRST_NAME & " " & myQuery.LAST_NAME> 
> </cfif>
>
>
> I prefer code block 2 as it is one less line, but are there any 
> technical merits between the two
>
> Does it matter? Should I get out more?  It can be grim up north you
> know
> :-)
>
> DC


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Reply via email to