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

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Reply via email to