[thelist] CF -- have a Q need a Tip to clean-up my webs.

.jeff jeff at members.evolt.org
Fri Oct 12 21:02:56 CDT 2001


joshua,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Joshua Olson
>
> : I suspect I know... reference vs. value assignment
> : in cfset.
> :
> : But, I need to _know_.
>
> My experience has been that simple values (the only of
> which is String in CF) are assigned by value.  Thus,
>
> <cfset a = "1">
> <cfset b = a>
> <cfset b = "2">
> <cfoutput>#a#, #b#</cfoutput>
>
> yields:
>
> 1,2
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

ah, compsci 101 should've stuck with ya alittle better.  testing for
assignment by reference involves changing the first variable's value after
assigning it as the value of the second variable.

<cfset a = 1>
<cfset b = a>
<cfset a = 2>

<cfoutput>
#a#, #b#
</cfoutput>

which yields, 2,1 as the output indicating that indeed values are copied by
value and not by reference, otherwise b would be equal to 2.

thanks,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list